{% load arctic_tags %}
{% load i18n %}

{% if paginator.num_pages > 1 or paginator.num_pages == -1 %}
    <div class="row paginator-block">
        {% if show_label %}
            <div class="col col-auto pagination-label">
                {% block pagination_label %}
                    <div class="pagination-info">
                        {{ page_obj.start_index }} &ndash; {{ page_obj.end_index }}{% if paginator.count != -1 %} {% trans 'of' %} {{ paginator.count }}{% endif %}
                    </div>
                {% endblock %}
            </div>
        {% endif %}
        <div class="col col-auto pagination-navigation">
            <ul class="pagination" role="navigation" aria-label="{% trans "Pagination" %}">
                {% if show_first_last %}
                    {% if page_obj.has_previous %}
                        <li class="page-item">
                            <a class="page-link" href="?{% get_parameters page %}page={{ first_page_index }}" aria-label="{% trans "Previous page" %}">
                                <i class="fa fa-angle-double-left"></i>
                            </a>
                        </li>
                    {% else %}
                        <li class="page-item disabled">
                            <span class="page-link">
                                <i class="fa fa-angle-double-left"></i>
                            </spam>
                        </li>
                    {% endif %}
                {% endif %}
                {% if page_obj.has_previous %}
                    <li class="page-item">
                        <a class="page-link" href="?{% get_parameters page %}page={{ page_obj.previous_page_number }}" aria-label="{% trans "Previous page" %}">
                            <i class="fa fa-angle-left"></i>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <span class="page-link">
                            <i class="fa fa-angle-left"></i>
                        </spam>
                    </li>
                {% endif %}

                {% if page_range %}
                    {% for i in page_range %}
                        {% if page_obj.number == i %}
                            <li class="page-item active">
                                <a class="page-link" href="#">{{ i }}<span class="sr-only">{% trans "(current)" %}</span></a>
                            </li>
                        {% else %}
                            <li class="page-item">
                                <a class="page-link" href="?{% get_parameters page %}page={{ i }}">{{ i }}</a>
                            </li>
                        {% endif %}
                    {% endfor %}
                {% endif %}

                {% if page_obj.has_next %}
                    <li class="page-item">
                        <a class="page-link" href="?{% get_parameters page %}page={{ page_obj.next_page_number }}" aria-label="{% trans "Next page" %}">
                            <i class="fa fa-angle-right"></i>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <span class="page-link">
                            <i class="fa fa-angle-right"></i>
                        </span>
                    </li>
                {% endif %}

            {% if show_first_last %}
                {% if page_obj.has_next %}
                    <li class="page-item">
                        <a class="page-link" href="?{% get_parameters page %}page={{ last_page_index }}" aria-label="{% trans "Last page" %}">
                            <i class="fa fa-angle-double-right"></i>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <span class="page-link">
                            <i class="fa fa-angle-double-right"></i>
                        </span>
                    </li>
                {% endif %}
            {% endif %}
            </ul>
        </div>
    </div>
{% endif %}
