<commit_before>{% import '@VanioWeb/menu.html.twig' as menu %}

{% if filter is defined %}
    {% set page = filter.page %}
{% endif %}

{% if page is defined %}
    <div class="paginator">
        <p class="paginator-info">
            {{ 'paginator.info'|trans({'%firstRecord%': page.firstRecord + 1, '%lastRecord%': min(page.lastRecord + 1, records|length), '%recordTotalCount%': records|length}, 'paginator')|raw }}
        </p>

        {% if records|length > page.recordsOnFirstPage %}
            {% set parameters = app.request.attributes.get('_route_params') + app.request.query.all %}
            {% set neighboursCount = neighboursCount ?? 3 %}
            {% set maximalPage = page.maximalPage(records|length) %}

            <div class="paginator-pages">
                <ul class="pagination">
                    {{ menu.item(null, {page: page.pageNumber - 1} + parameters, {class: {'pagination-previous': true, active: false, disabled: page.pageNumber == 1}}, {href: page.pageNumber == 1 ? false : null, label: '«'}) }}
                    {{ menu.item(null, {page: 1} + parameters, {class: {active: page.pageNumber == 1}}, {label: 1}) }}

                    {% if page.pageNumber - neighboursCount > 2 %}<li class="disabled"><a>…</a></li>{% endif %}

                    {% if maximalPage > 2 %}
                        {% for pageNumber in max(page.pageNumber - neighboursCount, 2)..min(maximalPage - 1, page.pageNumber + neighboursCount) %}
                            {{ menu.item(null, {page: pageNumber} + parameters, {class: {active: page.pageNumber == pageNumber}}, {label: pageNumber}) }}
                        {% endfor %}
                    {% endif %}
<commit_msg>Fix of paginator. #11958<commit_after>{% import '@VanioWeb/menu.html.twig' as menu %}

{% if filter is defined %}
    {% set page = filter.page %}
{% endif %}

{% if page is defined %}
    <div class="paginator">
        <p class="paginator-info">
            {{ 'paginator.info'|trans({'%firstRecord%': page.firstRecord + 1, '%lastRecord%': min(page.lastRecord, records|length), '%recordTotalCount%': records|length}, 'paginator')|raw }}
        </p>

        {% if records|length > page.recordsOnFirstPage %}
            {% set parameters = app.request.attributes.get('_route_params') + app.request.query.all %}
            {% set neighboursCount = neighboursCount ?? 3 %}
            {% set maximalPage = page.maximalPage(records|length) %}

            <div class="paginator-pages">
                <ul class="pagination">
                    {{ menu.item(null, {page: page.pageNumber - 1} + parameters, {class: {'pagination-previous': true, active: false, disabled: page.pageNumber == 1}}, {href: page.pageNumber == 1 ? false : null, label: '«'}) }}
                    {{ menu.item(null, {page: 1} + parameters, {class: {active: page.pageNumber == 1}}, {label: 1}) }}

                    {% if page.pageNumber - neighboursCount > 2 %}<li class="disabled"><a>…</a></li>{% endif %}

                    {% if maximalPage > 2 %}
                        {% for pageNumber in max(page.pageNumber - neighboursCount, 2)..min(maximalPage - 1, page.pageNumber + neighboursCount) %}
                            {{ menu.item(null, {page: pageNumber} + parameters, {class: {active: page.pageNumber == pageNumber}}, {label: pageNumber}) }}
                        {% endfor %}
                    {% endif %}

{'fraction_non_alphanumeric': 0.1703442188879082, 'fraction_numerical': 0.0088261253309797, 'mean_word_length': 2.3966033966033966, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5506879', 'n_tokens_mistral': 1062, 'n_tokens_neox': 935, 'n_words': 224}