{% load i18n %}

{% if is_paginated %}
    <div class="pagination">
        <ul>

            <li class="prev {% if not page_obj.has_previous %}disabled{% endif %}">
                <a href="{% if page_obj.has_previous %}?page={{ page_obj.previous_page_number }}{% else %}#{% endif %}" >← {% trans "previous page" %}</a>
            </li>
            {% for page in page_obj.pages %}
                {% if page %}
                    <li {% ifequal page page_obj.number %}class="disabled"{% endifequal %}>
                        <a href="?{{ page.querystring }}" class="page">{{ page }}</a>
                    </li>
                {% else %}
                    <li class="disabled">
                        ...
                    </li>
                {% endif %}
            {% endfor %}
            <li class="next {% if not page_obj.has_next %}disabled{% endif %}">
                <a href="{% if page_obj.has_next %}?page={{ page_obj.next_page_number }}{% else %}#{% endif %}" >{% trans "next page" %} →</a>
            </li>
        </ul>
    </div>
{% endif %}