{% extends base_template %}
{% block content %}
    {% block table %}
    {% endblock table %}
    {% if page.has_other_pages %}
        <nav hx-target="#main" hx-swap="outerHTML" hx-push-url="true">
            <ul class="pagination justify-content-end">
                {% if page.number != 1 %}
                    <li class="page-item">
                        <a class="page-link" hx-get="?page=1" href="?page=1" aria-label="First">
                            <span aria-hidden="true">«</span>
                            <span class="sr-only">First</span>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <a class="page-link" aria-label="First">
                            <span aria-hidden="true">«</span>
                            <span class="sr-only">First</span>
                        </a>
                    </li>
                {% endif %}
                {% if page.has_previous %}
                    <li class="page-item">
                        <a class="page-link"
                           hx-get="?page={{ page.previous_page_number }}"
                           href="?page={{ page.previous_page_number }}"
                           aria-label="Previous">
                            <span aria-hidden="true">‹</span>
                            <span class="sr-only">Previous</span>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <a class="page-link" aria-label="Previous">
                            <span aria-hidden="true">‹</span>
                            <span class="sr-only">Previous</span>
                        </a>
                    </li>
                {% endif %}
                <li class="page-item disabled">
                    <a class="page-link" aria-label="Current">Page {{ page.number }} of {{ page.paginator.num_pages }}</a>
                </li>
                {% if page.has_next %}
                    <li class="page-item">
                        <a class="page-link"
                           hx-get="?page={{ page.next_page_number }}"
                           href="?page={{ page.next_page_number }}"
                           aria-label="Next">
                            <span aria-hidden="true">›</span>
                            <span class="sr-only">Next</span>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <a class="page-link" aria-label="Next">
                            <span aria-hidden="true">›</span>
                            <span class="sr-only">Next</span>
                        </a>
                    </li>
                {% endif %}
                {% if page.number != page.paginator.num_pages %}
                    <li class="page-item">
                        <a class="page-link"
                           hx-get="?page={{ page.paginator.num_pages }}"
                           href="?page={{ page.paginator.num_pages }}"
                           aria-label="Last">
                            <span aria-hidden="true">»</span>
                            <span class="sr-only">Last</span>
                        </a>
                    </li>
                {% else %}
                    <li class="page-item disabled">
                        <a class="page-link" aria-label="Last">
                            <span aria-hidden="true">»</span>
                            <span class="sr-only">Last</span>
                        </a>
                    </li>
                {% endif %}
            </ul>
        </nav>
    {% endif %}
{% endblock content %}
