{#
this is not the twig version of the php paging template in this folder
this is a generic paging template
#}
{% set leftIcon = leftIcon|default('icon-arrow-left page-link__arrow') %}
{% set rightIcon = rightIcon|default('icon-arrow-right page-link__arrow') %}
{% set hideCount = hideCount|default(false) %}
{% set addClassArray = addClassArray|default([]) %}
{% if hideCount %}
{% set addClassArray = addClassArray|merge(['no-paging--count']) %}
{% endif %}
{% set path = app.request.get("baseUrl") %}
{% do app.request.query.remove("baseUrl") %}
{% do app.request.query.remove("page") %}
{% do app.request.query.remove("ajax") %}
{% set queryString = "" %}
{% if app.request.query is not empty %}
{% set queryString = "&" ~ app.request.query.all | url_encode %}
{% endif %}
{% if addClass|default('') is not empty %}
{% set addClassArray = addClassArray|merge([addClass]) %}
{% endif %}
{% set totalItemCount = demi_hasKnpPaginator() ? totalCount|default(0) : totalItemCount|default(0) %}
<div class="{{ pagingClass|default('') }}">
<div class="row align-items-center {{ addClassArray|join('') }}">
{% if not hideCount %}
<div class="col-md-4 has-paging--count">
<div class="row row--gutter-with-10">
<div class="col-md-auto text-center text-md-left text-nowrap">
{{ totalItemCount }} {{ totalItemCount == 1 ? resultTk|default('demi.infrastructure.paging.result')|trans : resultsTk|default('demi.infrastructure.paging.results')|trans }}
</div>
</div>
</div>
{% endif %}
{% if pageCount > 1 %}
<div class="col-md-8 has-paging--list">
<ul class="pagination justify-content-center justify-content-md-end js-filter-form-paging">
{% if previous|default('') %}
{% do pimcore_placeholder('headPrev').set('<link rel="prev" href="' ~ path ~ "?page=" ~ previous ~ queryString ~ '">') %}
<li class="li-has-arrow page-item">
<a class="page-link {{ pageLinkClass|default('') }}" href="{{ path ~ "?page=" ~ previous ~ queryString }}"
data-page="{{ previous }}" rel="prev">
<span class="icon icon-in-text {{ leftIcon }}"></span>
</a>
</li>
{% else %}
<li class="disabled li-has-arrow page-item">
<a class="page-link" href="#">
<span class="icon icon-in-text {{ leftIcon }}"></span>
</a>
</li>
{% endif %}
{% if showFirstLast|default(false) %}
{% if firstPageInRange != first %}
<li class="page-item">
<a class="page-link {{ pageLinkClass|default('') }}"
href="{{ path ~ "?page=" ~ first }}" data-page="{{ first }}">
{{ first }}
</a>
</li>
{% endif %}
{% if firstPageInRange > first +1 and firstPageInRange < first+3 %}
<li class="page-item">
<a class="page-link {{ pageLinkClass|default('') }}"
href="{{ path ~ "?page=" ~ first+1 ~ queryString }}" data-page="{{ first+1 }}">
{{ first+1 }}
</a>
</li>
{% endif %}
{% if firstPageInRange > first +2 %}
<li class="page-item">
<a class="page-link" href="#">...</a>
</li>
{% endif %}
{% endif %}
{% for page in pagesInRange %}
{% if page != current %}
<li class="page-item">
<a class="page-link {{ pageLinkClass|default('') }}" href="{{ path ~ "?page=" ~ page ~ queryString }}"
data-page="{{ page }}">
{{ page }}
</a>
</li>
{% else %}
<li class="active page-item">
<a class="page-link {{ pageLinkClass|default('') }}" href="" data-page="{{ page }}">
{{ page }}
<span class="sr-only">({{ 'sr.page.current'|trans }})</span>
</a>
</li>
{% endif %}
{% endfor %}
{% if showFirstLast|default(false) %}
{% if lastPageInRange < last-2 %}
<li class="disabled page-item">
<a class="page-link {{ pageLinkClass|default('') }}" href="#">...</a>
</li>
{% endif %}
{% if lastPageInRange < last-1 and lastPageInRange > last-3 %}
<li class="page-item">
<a class="page-link {{ pageLinkClass|default('') }}"
href="{{ path ~ "?page=" ~ last-1 ~ queryString }}" data-page="{{ last-1 }}">
{{ last-1 }}
</a>
</li>
{% endif %}
{% if lastPageInRange != last %}
<li class="page-item">
<a class="page-link {{ pageLinkClass|default('') }}" href="{{ path ~ "?page=" ~ last ~ queryString }}"
data-page="{{ last }}">
{{ last }}
</a>
</li>
{% endif %}
{% endif %}
{% if next|default(null) %}
{% do pimcore_placeholder('headNext').set('<link rel="next" href="' ~ path ~ "?page=" ~ next ~ queryString ~ '">') %}
<li class="page-item">
<a class="page-link {{ pageLinkClass|default('') }}" href="{{ path ~ "?page=" ~ next ~ queryString }}"
data-page="{{ next }}">
<span class="icon icon-in-text {{ rightIcon }}"></span>
</a>
</li>
{% else %}
<li class="disabled li-has-arrow page-item">
<a class="page-link" href="#">
<span class="icon icon-in-text {{ rightIcon }}"></span>
</a>
</li>
{% endif %}
</ul>
</div>
{% endif %}
</div>
</div>