{% comment %}
    Usage:
        {% include "django_cradmin/viewhelpers/includes/pager.django.html" %}

    Required context variables:

        is_paginated
        page_obj

    These are added automatically by ListView if you specify paginate_by.

    Option context variables:

        extra_querystring
            Appended to the querystring.
        pager_extraclass
            Extra css class(es) to add to the pager in addition to ``.pager``.
{% endcomment %}
{% load i18n %}

{% if is_paginated %}
    <div class="{% if pager_container_cssclass %}{{ pager_container_cssclass }}{% else %}container-fluid{% endif %} pager-container">
        <ul class="pager {{ pager_extraclass }}">
            <li class="previous {% if not page_obj.has_previous %}disabled{% endif %}">
                <a href="?page={% if page_obj.has_previous %}{{ page_obj.previous_page_number }}{% else %}1{% endif %}&amp;{{ extra_querystring }}">
                    <i class="fa fa-chevron-left"></i>
                    <span class="sr-only">{% trans "Previous" %}</span>
                </a>
            </li>
            <li class="pager-counter">
                {% blocktrans with number=page_obj.number total=page_obj.paginator.num_pages %}Page {{ number }} of {{ total }}{% endblocktrans %}
            </li>
            <li class="next {% if not page_obj.has_next %}disabled{% endif %}">
                <a href="?page={% if page_obj.has_next %}{{ page_obj.next_page_number }}{% else %}last{% endif %}&amp;{{ extra_querystring }}">
                    <i class="fa fa-chevron-right"></i>
                    <span class="sr-only">{% trans "Next" %}</span>
                </a>
            </li>
        </ul>
    </div>
{% endif %}
