HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/hcv/wp-content/themes/hockey/templates/partials/pagination.twig
{% if posts.pagination.pages is not empty %}
    <div class="pagination">
        {% if posts.pagination.pages|first and posts.pagination.prev != '' %}
            <a href="{{ posts.pagination.pages|first.link }}" class="previous">FIRST</a>
        {% else %}
            <span class="previous disabled">FIRST</span>
        {% endif %}

            {% set current = posts.pagination.current %}
            {% set total = posts.pagination.total %}

            {# if current page is less than 3 show first 5 pages #}
            {% if current <= 3 %} 

                {% for page in posts.pagination.pages %}
                    {% if page.title <= 5 %}
                        {% if page.link %}
                            <a href="{{page.link}}" class="page">{{page.title}}</a>
                        {% else %}
                            <span class="page active">{{page.title}}</span>
                        {% endif %}
                    {% endif %}
                {% endfor %}

            {# if current page is in last 3 show last 5 pages #}
            {% elseif current >= (total - 2) %} 

                {% for page in posts.pagination.pages %}
                    {% if page.title >= (total - 4) %}
                        {% if page.link %}
                            <a href="{{page.link}}" class="page">{{page.title}}</a>
                        {% else %}
                            <span class="page active">{{page.title}}</span>
                        {% endif %}
                    {% endif %}
                {% endfor %}

            {# else show two pages before and two after the current page  #}
            {% else  %} 
                {% for page in posts.pagination.pages %}
                    {% if (page.title >= (current - 2)) and (page.title <=  ( current + 2 ))%}
                        {% if page.link %}
                            <a href="{{page.link}}" class="page">{{page.title}}</a>
                        {% else %}
                            <span class="page active">{{page.title}}</span>
                        {% endif %}
                    {% endif %}
                {% endfor %}
            {% endif %}

        {% if posts.pagination.pages|last and posts.pagination.next != '' %}
            <a href="{{ posts.pagination.pages|last.link }}" class="next">LAST</a>
        {% else %}
            <span class="next disabled">LAST</span>
        {% endif %}

    </div>
{% endif %}

{# {% if posts.pagination.pages is not empty %}
    <div class="pagination">
        {% if posts.pagination.pages|first and posts.pagination.prev != '' %}
            <a href="{{ posts.pagination.pages|first.link }}" class="previous">FIRST</a>
        {% else %}
            <span class="previous disabled">FIRST</span>
        {% endif %}

        {% for page in posts.pagination.pages %}
            {% if page.link %}
                <a href="{{page.link}}" class="page">{{page.title}}</a>
            {% else %}
                <span class="page active">{{page.title}}</span>
            {% endif %}
        {% endfor %}
        {% if posts.pagination.pages|last and posts.pagination.next != '' %}
            <a href="{{ posts.pagination.pages|last.link }}" class="next">LAST</a>
        {% else %}
            <span class="next disabled">LAST</span>
        {% endif %}
    </div>
{% endif %} #}