2023-05-04 22:58:49 +00:00
|
|
|
|
2023-05-04 22:15:13 +00:00
|
|
|
<nav>
|
|
|
|
<ul class="pagination pagination-sm mb-0 mt-4 pl-1">
|
2023-05-05 00:39:54 +00:00
|
|
|
{% if not size %}
|
|
|
|
{% set size = PAGE_SIZE %}
|
|
|
|
{% endif %}
|
2023-05-04 22:15:13 +00:00
|
|
|
{% set num_pages = (next_exists / size) | round(0, 'ceil') | int %}
|
|
|
|
|
|
|
|
{% set start_point = page - 2 %}
|
|
|
|
{% if start_point < 1 %}
|
|
|
|
{% set start_point = 1 %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% set end_point = start_point+4 %}
|
|
|
|
{% if end_point > num_pages %}
|
|
|
|
{% set start_point = start_point-(end_point-num_pages) %}
|
|
|
|
{% set end_point = num_pages %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% if start_point < 1 %}
|
|
|
|
{% set start_point = 1 %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
|
|
|
|
{% if start_point > 1 %}
|
|
|
|
<li class="page-item">
|
2023-05-04 22:58:49 +00:00
|
|
|
<small><a class="page-link" href="{{1|change_page|safe}}">1</a></small>
|
2023-05-04 22:15:13 +00:00
|
|
|
</li>
|
|
|
|
|
|
|
|
{% if start_point == 3 %}
|
|
|
|
<li class="page-item">
|
2023-05-04 22:58:49 +00:00
|
|
|
<small><a class="page-link" href="{{2|change_page|safe}}">2</a></small>
|
2023-05-04 22:15:13 +00:00
|
|
|
</li>
|
|
|
|
{% elif start_point != 2 %}
|
|
|
|
<li class="page-item">
|
|
|
|
<small class="page-link dots">...</small>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
{% for x in range(start_point, end_point+1) %}
|
|
|
|
<li class="page-item">
|
2023-05-04 22:58:49 +00:00
|
|
|
<small><a class="page-link {% if x == page %}active{% endif %}" href="{{x|change_page|safe}}">{{x}}</a></small>
|
2023-05-04 22:15:13 +00:00
|
|
|
</li>
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
{% if end_point < num_pages %}
|
|
|
|
{% if end_point == num_pages-2 %}
|
|
|
|
<li class="page-item">
|
2023-05-04 22:58:49 +00:00
|
|
|
<small><a class="page-link" href="{{(num_pages-1)|change_page|safe}}">{{num_pages-1}}</a></small>
|
2023-05-04 22:15:13 +00:00
|
|
|
</li>
|
|
|
|
{% elif end_point != num_pages-1 %}
|
|
|
|
<li class="page-item">
|
|
|
|
<small class="page-link dots">...</small>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
<li class="page-item">
|
2023-05-04 22:58:49 +00:00
|
|
|
<small><a class="page-link" href="{{num_pages|change_page|safe}}">{{num_pages}}</a></small>
|
2023-05-04 22:15:13 +00:00
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
</ul>
|
|
|
|
</nav>
|