{% block component_pagination_nav %}
{% set currentPage = ((criteria.offset + 1) / criteria.limit)|round(0, 'ceil') %}
{% set totalEntities = total ? total : entities.total %}
{% set totalPages = (totalEntities / criteria.limit)|round(0, 'ceil') %}
{% set paginationSuffix = '' %}
{# @deprecated tag:v6.5.0 - pagination template will append `paginationSuffix` for input and label ids to avoid duplicate ids. #}
{% if feature('v6.5.0.0') and paginationLocation %}
{% set paginationSuffix = '-' ~ paginationLocation %}
{% endif %}
{% if totalPages > 1 %}
<nav aria-label="pagination" class="pagination-nav">
{% block component_pagination %}
<ul class="pagination">
{% block component_pagination_first %}
<li class="page-item page-first{% if currentPage == 1 %} disabled{% endif %}">
{% block component_pagination_first_input %}
<input type="radio"
{% if currentPage == 1 %}disabled="disabled"{% endif %}
name="p"
id="p-first{{ paginationSuffix }}"
value="1"
class="d-none"
title="pagination">
{% endblock %}
{% block component_pagination_first_label %}
<label class="page-link" for="p-first{{ paginationSuffix }}">
{% block component_pagination_first_link %}
{% sw_icon 'arrow-medium-double-left' style { 'size': 'fluid', 'pack': 'solid'} %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% block component_pagination_prev %}
<li class="page-item page-prev{% if currentPage == 1 %} disabled{% endif %}">
{% block component_pagination_prev_input %}
<input type="radio"
{% if currentPage == 1 %}disabled="disabled"{% endif %}
name="p"
id="p-prev{{ paginationSuffix }}"
value="{{ currentPage - 1 }}"
class="d-none"
title="pagination">
{% endblock %}
{% block component_pagination_prev_label %}
<label class="page-link" for="p-prev{{ paginationSuffix }}">
{% block component_pagination_prev_link %}
{% block component_pagination_prev_icon %}
{% sw_icon 'arrow-medium-left' style {'size': 'fluid', 'pack': 'solid'} %}
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% block component_pagination_loop %}
{% set start = currentPage - 2 %}
{% if start <= 0 %}
{% set start = currentPage - 1 %}
{% if start <= 0 %}
{% set start = currentPage %}
{% endif %}
{% endif %}
{% set end = start + 4 %}
{% if end > totalPages %}
{% set end = totalPages %}
{% endif %}
{% for page in start..end %}
{% set isActive = (currentPage == page) %}
{% block component_pagination_item %}
<li class="page-item{% if isActive %} active{% endif %}">
{% block component_pagination_item_input %}
<input type="radio"
name="p"
id="p{{ page }}{{ paginationSuffix }}"
value="{{ page }}"
class="d-none"
title="pagination"
{% if isActive %}checked="checked"{% endif %}>
{% endblock %}
{% block component_pagination_item_label %}
<label class="page-link"
for="p{{ page }}{{ paginationSuffix }}">
{% block component_pagination_item_link %}
{% block component_pagination_item_text %}
{{ page }}
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% endfor %}
{% endblock %}
{% block component_pagination_next %}
<li class="page-item page-next{% if currentPage == totalPages %} disabled{% endif %}">
{% block component_pagination_next_input %}
<input type="radio"
{% if currentPage == totalPages %}disabled="disabled"{% endif %}
name="p"
id="p-next{{ paginationSuffix }}"
value="{{ currentPage + 1 }}"
class="d-none"
title="pagination">
{% endblock %}
{% block component_pagination_next_label %}
<label class="page-link" for="p-next{{ paginationSuffix }}">
{% block component_pagination_next_link %}
{% block component_pagination_next_icon %}
{% sw_icon 'arrow-medium-right' style { 'size': 'fluid', 'pack': 'solid'} %}
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
{% block component_pagination_last %}
<li class="page-item page-last{% if currentPage == totalPages %} disabled{% endif %}">
{% block component_pagination_last_input %}
<input type="radio"
{% if currentPage == totalPages %}disabled="disabled"{% endif %}
name="p"
id="p-last{{ paginationSuffix }}"
value="{{ totalPages }}"
class="d-none"
title="pagination">
{% endblock %}
{% block component_pagination_last_label %}
<label class="page-link" for="p-last{{ paginationSuffix }}">
{% block component_pagination_last_link %}
{% block component_pagination_last_icon %}
{% sw_icon 'arrow-medium-double-right' style {
'size': 'fluid',
'pack': 'solid'
} %}
{% endblock %}
{% endblock %}
</label>
{% endblock %}
</li>
{% endblock %}
</ul>
{% endblock %}
</nav>
{% endif %}
{% endblock %}