{% set pagination = pagination|default(page.collection.params.pagination) %}
{% set base_url = base_url|default(page.url) %}

{% if pagination|length > 1 %}
<ul class="pagination" role="navigation" aria-label="Pagination">
    {% if pagination.hasPrev %}
        {% set url = (base_url ~ pagination.params ~ pagination.prevUrl)|replace({'//':'/'}) %}
        <li><a href="{{ url }}" rel="prev"><i class="fa-solid fa-angle-left" aria-hidden="true"></i></a></li>
    {% else %}
        <li class="disabled"><span><i class="fa-solid fa-angle-left" aria-hidden="true"></i></span></li>
    {% endif %}

    {% for paginate in pagination %}
        {% if paginate.isCurrent %}
            <li class="active"><span>{{ paginate.number }}</span></li>
        {% elseif paginate.isInDelta %}
            {% set url = (base_url ~ pagination.params ~ paginate.url)|replace({'//':'/'}) %}
            <li><a href="{{ url }}">{{ paginate.number }}</a></li>
        {% elseif paginate.isDeltaBorder %}
            <li class="disabled"><span>&hellip;</span></li>
        {% endif %}
    {% endfor %}

    {% if pagination.hasNext %}
        {% set url = (base_url ~ pagination.params ~ pagination.nextUrl)|replace({'//':'/'}) %}
        <li><a href="{{ url }}" rel="next"><i class="fa-solid fa-angle-right" aria-hidden="true"></i></a></li>
    {% else %}
        <li class="disabled"><span><i class="fa-solid fa-angle-right" aria-hidden="true"></i></span></li>
    {% endif %}
</ul>
{% endif %}
