<!--
SPDX-FileCopyrightText: 2017-present Tobias Kunze
SPDX-License-Identifier: AGPL-3.0-only WITH LicenseRef-Pretalx-AGPL-3.0-Terms
-->

{% load humanize %}
{% load i18n %}

{% if page_obj.paginator.count > 1 %}
    <nav class="text-center">
        <ul class="pagination justify-content-center mb-0">
            {% if page_obj.has_other_pages %}
                {% if page_obj.has_previous %}
                    <li class="page-item">
                        <a rel="prev" href="{% querystring page=page_obj.previous_page_number %}" class="page-link">
                            <span>«</span>
                        </a>
                    </li>
                {% endif %}
                <li class="page-current page-item disabled">
                    <a class="page-link">
                        {% blocktranslate trimmed with page=page_obj.number of=page_obj.paginator.num_pages count=page_obj.paginator.count %}
                            Page {{ page }} of {{ of }} ({{ count }} elements)
                        {% endblocktranslate %}
                    </a>
                </li>
                {% if page_obj.has_next %}
                    <li class="page-item">
                        <a rel="next" href="{% querystring page=page_obj.next_page_number %}" class="page-link">
                            <span>»</span>
                        </a>
                    </li>
                {% endif %}
            {% else %}
                {% if page_obj.paginator.count > 1 %}
                    <li class="page-current page-item">
                        <a class="page-link">
                            {% blocktranslate trimmed with count=page_obj.paginator.count|intcomma context "Shown at the bottom of lists, always > 1 elements." %}
                                {{ count }} elements
                            {% endblocktranslate %}
                        </a>
                    </li>
                {% endif %}
            {% endif %}
        </ul>
        {% if pagination_sizes and page_obj.paginator.count > 25 %}
            <div>
                <small>
                    {% trans "Show per page:" context "Allows users to select how many lines/elements are shown in lists." %}
                </small>
                {% for pagination_size in pagination_sizes %}

                    {% include "orga/includes/pagination_size.html" %}

                    {% if not forloop.last %}|{% endif %}
                {% endfor %}
            </div>
        {% endif %}
    </nav>
{% endif %}
