{# Pagination for django-pagination #}
{% load i18n %}

{% if is_paginated %}
    <ul class="pagination">
        {% if page_obj.has_previous %}
            <li class="prev">
                <a href="?page={{ page_obj.previous_page_number|stringformat:"d" }}{{ getvars }}{{ hashtag }}">← {% trans "Previous" %}</a>
            </li>
        {% else %}
            <li class="prev disabled"><a>← {% trans "Previous" %}</a></li>
        {% endif %}
        {% for page in pages %}
            {% if page %}
                <li class="{% ifequal page page_obj.number %}active{% endifequal %}"><a href="?page={{ page|stringformat:"d" }}{{ getvars }}{{ hashtag }}">{{ page|stringformat:"d" }}</a></li>
            {% else %}
                <li class="disabled"><a href="#">…</a></li>
            {% endif %}
        {% endfor %}
        {% if page_obj.has_next %}
            <li class="next"><a href="?page={{ page_obj.next_page_number|stringformat:"d" }}{{ getvars }}{{ hashtag }}">{% trans "Next" %} →</a></li>
        {% else %}
            <li class="next disabled"><a>{% trans "Next" %} →</a></li>
        {% endif %}
    </ul>
{% endif %}

