{% load django_tables2 %}

{% if page and paginator.num_pages > 1 %}
  <ul class="pagination center">
    {% if page.has_previous %}
      <li class="waves-effect">
        <a href="?page={{ page.previous_page_number }}" class="page-link">
          <i class="material-icons">chevron_left</i>
        </a>
      </li>
    {% endif %}
    {% if page.has_previous or page.has_next %}
      {% for p in page|table_page_range:paginator %}
        <li class="{% if page.number == p %} active{% endif %} waves-effect">
          <a {% if p != '...' %}href="?page={{ p }}"{% endif %}>
            {{ p }}
          </a>
        </li>
      {% endfor %}
    {% endif %}
    {% if page.has_next %}
      <li class="waves-effect">
        <a href="?page={{ page.next_page_number }}" class="page-link">
          <i class="material-icons">chevron_right</i>
        </a>
      </li>
    {% endif %}
  </ul>
{% endif %}
