<ul>
  {% if page.has_previous %}
  <li><a href="?page={{ page.previous_page_number }}{% if order %}&order={{ order|urlencode }}{% endif %}">previous</a></li>
  {% endif %}
  <li>Page {{ page.number }} of {{ page.paginator.num_pages }}.</li>
  {% if page.has_next %}
  <li><a href="?page={{ page.next_page_number }}{% if order %}&order={{ order|urlencode }}">next</a></li>
  {% endif %}
</ul>

<ul>
  {% if page.has_previous %}
  <li><a href="?page={{ page.previous_page_number }}{% if order %}&order={{ order|urlencode }}{% endif %}">previous</a></li>
  {% endif %}
  <li>Page {{ page.number }} of {{ page.paginator.num_pages }}.</li>
  {% if page.has_next %}
  <li><a href="?page={{ page.next_page_number }}{% if order %}&order={{ order|urlencode }}{% endif %}">next</a></li>
  {% endif %}
</ul>

Add missing close ``endif`` tag in template.
Add missing close ``endif`` tag in template.
