{% load django_tables2 %}
{% load i18n %}
{% if not table.infinite_scroll and not table.infinite_load %}
  {% if table.page and table.paginator.num_pages > 1 %}
    <nav aria-label="Table navigation">
      <ul class="pagination justify-content-center pb-2">
        {% if table.page.has_previous %}
          {% block pagination.previous %}
            <li class="previous page-item">
              <a href="{% querystring table.prefixed_page_field=table.page.previous_page_number without "_width" without "_height" %}"
                 class="page-link">
                <span aria-hidden="true">&laquo;</span>
                {% trans 'Previous' %}
              </a>
            </li>
          {% endblock pagination.previous %}
        {% endif %}
        {% if table.page.has_previous or table.page.has_next %}
          {% block pagination.range %}
            {% for p in table.page|table_page_range:table.paginator %}
              <li class="page-item{% if table.page.number == p %} active{% endif %}">
                <a class="page-link"
                   {% if p != '...' %}href="{% querystring table.prefixed_page_field=p without "_width" without "_height" %}"{% endif %}>
                  {{ p }}
                </a>
              </li>
            {% endfor %}
          {% endblock pagination.range %}
        {% endif %}
        {% if table.page.has_next %}
          {% block pagination.next %}
            <li class="next page-item">
              <a href="{% querystring table.prefixed_page_field=table.page.next_page_number without "_width" without "_height" %}"
                 class="page-link">
                {% trans 'Next' %}
                <span aria-hidden="true">&raquo;</span>
              </a>
            </li>
          {% endblock pagination.next %}
        {% endif %}
      </ul>
    </nav>
  {% endif %}
{% endif %}