{# @var \Zend\Paginator\Paginator paginator #}
{% set hideCount = hideCount |default(false) %}
{% set pages = paginator.getPaginationData() %}
{% set ajaxPaging = ajaxPaging|default(false) %}
{% set filterFormPaging = filterFormPaging is defined ? filterFormPaging : false %}
{% set ajaxClass = ajaxClass|default('js-ajax-form__link') %}
{% set object = object|default(null) %}
{% set addClassArray = [] %}
{% if hideCount %}
{% set addClassArray = addClassArray | merge(['no-paging--count']) %}
{% endif %}
{% if addClass is defined %}
{% set addClassArray = addClassArray | merge([addClass]) %}
{% endif %}
{% set hashSuffix = '' %}
{% if hashtag is defined and hashtag is not empty %}
{% set hashSuffix = '#' . hashtag %}
{% endif %}
{% set pageParamName = pageParamName|default('page') %}
{% if hideCount %}
{% block paging %}
{% if pages.pageCount > 1 %}
<nav aria-label="{{ 'sr.pagination'|trans }}" class="pagination-container">
<ul class="pagination align-items-center {{ addClassArray|join(' ') }} {{ filterFormPaging ? 'js-filter-form__paging' : '' }}">
{% if pages.previous is defined %}
{% if object is defined %}
{% set prevUrl = pimcore_url({ 'object': object, (pageParamName): pages.previous }) %}
{% else %}
{% set prevUrl = pimcore_url({ (pageParamName): pages.previous }) %}
{% endif %}
{% if pages.previous == 1 %}
{% set prevUrl = elements_page_1_query( prevUrl, object ) %}
{% endif %}
{% do pimcore_placeholder('headPrev').set('<link rel="prev" href="' ~ prevUrl ~ '">') %}
<li class="page-item">
<a class="page-link page-link--text {{ ajaxPaging ? ajaxClass : '' }} "
href="{{ prevUrl ~ hashSuffix }}" rel="prev" data-page="{{ prevUrl }}">
{{ 'paging.zurück'|trans }}
</a>
</li>
{% else %}
<li class="page-item disabled">
<div class="page-link page-link--text {{ ajaxPaging ? ajaxClass : '' }}">
{{ 'paging.zurück'|trans }}
</div>
</li>
{% endif %}
{% if showFirstLast is defined and showFirstLast is not empty %}
{# // add ... if there many pages ... so you can see the link to the FIRST page ... like: < 1 ... 5 6 (7) 8 9 ... 11 > #}
{% if pages.firstPageInRange != pages.first %}
{% if object is defined %}
{% set firstUrl = elements_page_1_query( pimcore_url({'object': object, (pageParamName): 1}, object) ) %}
{% else %}
{% set firstUrl = elements_page_1_query( pimcore_url({(pageParamName): 1}, object) ) %}
{% endif %}
<li class="page-item">
<a class="page-link {{ ajaxPaging ? ajaxClass : '' }}"
href="{{ firstUrl ~ hashSuffix }}" data-page="{{ pages.first }}">
{{ pages.first }}
</a>
</li>
{% endif %}
{% if pages.firstPageInRange > pages.first+1 and pages.firstPageInRange < pages.first+3 %}
{% if object is defined %}
{% set firstPlusOneUrl = elements_page_1_query( pimcore_url({'object': object, (pageParamName): pages.first+1}, object) ) %}
{% else %}
{% set firstPlusOneUrl = elements_page_1_query( pimcore_url({(pageParamName): pages.first+1}, object) ) %}
{% endif %}
<li class="page-item">
<a class="page-link {{ ajaxPaging ? ajaxClass : '' }}"
href="{{ firstPlusOneUrl ~ hashSuffix }}" data-page="{{ pages.first+1 }}">
{{ pages.first+1 }}
</a>
</li>
{% endif %}
{% if pages.firstPageInRange > pages.first+2 %}
<li class="disabled page-item">
<a class="page-link" href="#" aria-disabled="true" tabindex="-1">...</a>
</li>
{% endif %}
{% endif %}
{% for page in pages.pagesInRange %}
{% if object is defined %}
{% set pageUrl = pimcore_url({'object': object, (pageParamName): page }) %}
{% else %}
{% set pageUrl = pimcore_url({ (pageParamName): page }) %}
{% endif %}
{# {{ dump(pimcore_url({ 'page': page })) }}#}
{% if page == 1 %}
{% set pageUrl = elements_page_1_query( pageUrl, object) %}
{% endif %}
{% if page != pages.current %}
<li class="page-item">
<a class="page-link {{ ajaxPaging ? ajaxClass : '' }}"
href="{{ pageUrl ~ hashSuffix }}" data-page="{{ page }}">
{{ page }}
</a>
</li>
{% else %}
<li class="active page-item">
<div class="page-link {{ ajaxPaging ? ajaxClass : '' }}"
data-page="{{ page }}">
{{ page }} <span class="sr-only">({{ 'sr.page.current'|trans }})</span>
</div>
</li>
{% endif %}
{% endfor %}
{% if showFirstLast is defined and showFirstLast is not empty %}
{# // add ... if there many pages ... so you can see the link to the LAST page ... like: < 1 ... 5 6 (7) 8 9 ... 12 > #}
{% if pages.lastPageInRange < pages.last-2 %}
<li class="disabled page-item">
<a class="page-link" href="#" aria-disabled="true" tabindex="-1">...</a>
</li>
{% endif %}
{% if pages.lastPageInRange < pages.last-1 and pages.lastPageInRange > pages.last-3 %}
{% if object is defined %}
{% set lastMinusOneUrl = pimcore_url({'object': object, (pageParamName): pages.last-1}) %}
{% else %}
{% set lastMinusOneUrl = pimcore_url({(pageParamName): pages.last-1}) %}
{% endif %}
<li class="page-item">
<a class="page-link {{ ajaxPaging ? ajaxClass : '' }}"
href="{{ pimcore_url({ (pageParamName): pages.last-1 }) ~ hashSuffix }}"
data-page="{{ pages.last-1 }}">
{{ pages.last-1 }}
</a>
</li>
{% endif %}
{% if pages.lastPageInRange != pages.last %}
{% if object is defined %}
{% set lastUrl = pimcore_url({'object': object, (pageParamName): pages.last}) %}
{% else %}
{% set lastUrl = pimcore_url({(pageParamName): pages.last}) %}
{% endif %}
<li class="page-item">
<a class="page-link {{ ajaxPaging ? ajaxClass : '' }}"
href="{{ lastUrl ~ hashSuffix }}">
{{ pages.last }}
</a>
</li>
{% endif %}
{% endif %}
{% if pages.next is defined %}
{% if object is defined %}
{% set nextUrl = pimcore_url({ 'object': object, (pageParamName): pages.next }) %}
{% else %}
{% set nextUrl = pimcore_url({ (pageParamName): pages.next }) %}
{% endif %}
{% do pimcore_placeholder('headNext').set('<link rel="next" href="' ~nextUrl ~ '">') %}
<li class="page-item">
<a class="page-link page-link--text {{ ajaxPaging ? ajaxClass : '' }}"
href="{{ nextUrl ~ hashSuffix }}" rel="next" data-page="{{ pages.next }}">
{{ 'paging.vor'|trans }}
</a>
</li>
{% else %}
<li class="page-item disabled">
<a href="#" class="page-link page-link--text {{ ajaxPaging ? ajaxClass : '' }}">
{{ 'paging.vor'|trans }}
</a>
</li>
{% endif %}
</ul>
</nav>
{% endif %}
{% endblock %}
{% else %}
<div class="row align-items-center text-dark-grey font-decorative vertical-gutter--3 my-3 my-md-5">
<div class="col-auto vertical-gutter__item">
{{ paginator.totalItemCount }} {{ 'result-info.Ergebnisse'|trans }}
</div>
{% if hasFilterButton|default(false) %}
<div class="col-auto ml-auto d-md-none vertical-gutter__item">
<button type="button" data-target="{{ filterTarget|default('filterTarget') }}"
class="btn btn-no-styling text-primary-light js-overlay-toggle">
<span class="icon icon-menu"></span> {{ 'result-info.Filter anzeigen'|trans }}
</button>
</div>
{% endif %}
<div class="col-md vertical-gutter__item">
{% if block('paging') is defined %}
{{ block('paging') }}
{% endif %}
</div>
</div>
{% endif %}