{% load shared %}

<ul class="pagination">
  {% if page.has_previous %}
    <li class="page-item">
      <a href="?{% update_query_string page=page.previous_page_number %}" tabindex="-1">Previous</a>
    </li>
  {% else %}
    <li class="page-item disabled">
      <a href="#" tabindex="-1">Previous</a>
    </li>
  {% endif %}

  {% for page_number in visible_page_numbers %}
    {% if page_number >= 0 %}
      <li class="page-item {% if page.number == page_number %}active{% endif %}">
        <a href="?{% update_query_string page=page_number %}">{{ page_number }}</a>
      </li>
    {% else %}
      <li class="page-item">
        <span>...</span>
      </li>
    {% endif %}
  {% endfor %}

  {% if page.has_next %}
    <li class="page-item">
      <a href="?{% update_query_string page=page.next_page_number %}" tabindex="-1">Next</a>
    </li>
  {% else %}
    <li class="page-item disabled">
      <a href="#" tabindex="-1">Next</a>
    </li>
  {% endif %}
</ul>