{% load i18n %}
{% load timepiece_tags %}
<div class="pagination">
  <ul>
    {% if page_obj.has_previous %}
      <li>
        {% with base_url="?" %}
          <a href="{{ base_url|add_parameters:request.GET }}&page={{ page_obj.previous_page_number }}"
             class="prev">&laquo; {% trans "previous" %}</a>
        {% endwith %}
      </li>
    {% else %}
      <li class="disabled">
        <a>&laquo; {% trans "previous" %}</a>
      </li>
    {% endif %}

    {% for page_num in paginator.page_range %}
      {% ifequal page_num page_obj.number %}
        <li class="active">
          <a>{{ page_num }}</a>
        </li>
      {% else %}
        <li>
          {% with base_url="?" %}
            <a href="{{ base_url|add_parameters:request.GET }}&page={{ page_num }}">{{ page_num }}</a>
          {% endwith %}
        </li>
      {% endifequal %}
    {% endfor %}

    {% if page_obj.has_next %}
      <li>
        {% with base_url="?" %}
          <a href="{{ base_url|add_parameters:request.GET }}&page={{ page_obj.next_page_number }}"
             class="next">{% trans "next" %} &raquo;</a>
        {% endwith %}
      </li>
    {% else %}
      <li class="disabled">
        <a class="disabled next">{% trans "next" %} &raquo;</a>
      </li>
    {% endif %}
  </ul>
</div>
