{% load i18n %}
{% load humanize %}
{% load urlreplace %}
{% if is_paginated or page_obj.paginator.count > 1 %}
<nav class="text-center pagination-container">
    <ul class="pagination">
        {% if is_paginated %}
            {% if page_obj.has_previous %}
                {% if page_obj.previous_page_number > 1 %}
                    <li>
                        <a href="?{% url_replace request 'page' page_obj.num_pages %}" title="{% trans "Go to page 1" %}">
                            <span class="fa fa-angle-double-left"></span>
                        </a>
                    </li>
                {% endif %}
                <li>
                    <a href="?{% url_replace request 'page' page_obj.previous_page_number %}" title="{% blocktrans with page=page_obj.previous_page_number %}Go to page {{ page }}{% endblocktrans %}">
                        <span class="fa fa-angle-left"></span>
                    </a>
                </li>
            {% endif %}
            <li class="page-current">
                <a {% if page_obj.paginator.count %}
                    class="pagination-selection"
                    data-href="?{% url_replace request 'page' '_PAGE_' %}"
                    data-max="{{ page_obj.paginator.num_pages }}"
                    title="{% trans "Click to choose a page" %}"
                    href="#"
                    {% endif %}>
                {% blocktrans trimmed with page=page_obj.number of=page_obj.paginator.num_pages count=page_obj.paginator.count|intcomma %}
                    Page {{ page }} of {{ of }} ({{ count }} elements)
                {% endblocktrans %}
                </a>
            </li>
            {% if page_obj.has_next %}
                <li>
                    <a href="?{% url_replace request 'page' page_obj.next_page_number %}" title="{% blocktrans with page=page_obj.next_page_number %}Go to page {{ page }}{% endblocktrans %}">
                        <span class="fa fa-angle-right"></span>
                    </a>
                </li>
            {% endif %}
            {% if page_obj.paginator.count and page_obj.paginator.num_pages > page_obj.next_page_number %}
                <li>
                    <a href="?{% url_replace request 'page' page_obj.paginator.num_pages %}" title="{% blocktrans with page=page_obj.paginator.num_pages %}Go to page {{ page }}{% endblocktrans %}">
                        <span class="fa fa-angle-double-right"></span>
                    </a>
                </li>
            {% endif %}
        {% else %}
            {% if page_obj.paginator.count > 1 %}
                <li class="page-current"><a>
                    {% blocktrans trimmed with count=page_obj.paginator.count|intcomma %}
                        {{ count }} elements
                    {% endblocktrans %}
                </a></li>
            {% endif %}
        {% endif %}
    </ul>
    {% if page_size %}
        <div class="clearfix">
            <small>
                {% trans "Show per page:" %}
            </small>
            <a href="?{% url_replace request "page_size" "25" "page" "1" %}">
                {% if page_size == 25 %}<strong>{% endif %}25{% if page_size == 25 %}</strong>{% endif %}</a> |
            <a href="?{% url_replace request "page_size" "50" "page" "1" %}">
                {% if page_size == 50 %}<strong>{% endif %}50{% if page_size == 50 %}</strong>{% endif %}</a> |
            <a href="?{% url_replace request "page_size" "100" "page" "1" %}">
                {% if page_size == 100 %}<strong>{% endif %}100{% if page_size == 100 %}</strong>{% endif %}</a>
        </div>
    {% endif %}
</nav>
{% endif %}