{# <!-- table footer based paginator for ListView --> #}
{% load i18n %}

<tfoot>
    <tr>
        <td colspan="2">{{ page_obj.paginator.count }} items in total</td>
        <td class="text-center">
            <nav aria-label="Page navigation">
                <ul class="pagination justify-content-center">
                    <li class="page-item {{ page_obj.has_previous|yesno:',disabled' }}">
                        <a class="page-link" {% if page_obj.has_previous %}
                            href="?page={{ page_obj.previous_page_number }}&per_page={{ page_obj.paginator.per_page }}"
                            {% else %} href="#" {% endif %} tabindex="-1">
                            <span aria-hidden="true">&lsaquo;</span>
                            <span class="sr-only">{% trans "Previous" %}</span>
                        </a>
                    </li>
                    {% for page_number in page_obj.paginator.page_range %}
                    <li class="page-item {% if page_number == page_obj.number %}active {% endif %}">
                        <a class="page-link"
                            href="?page={{ page_number }}&per_page={{ page_obj.paginator.per_page }}">{{ page_number }}</a>
                    </li>
                    {% endfor %}
                    <li class="page-item {{ page_obj.has_next|yesno:',disabled' }}">
                        <a class="page-link" {% if page_obj.has_next %}
                            href="?page={{ page_obj.next_page_number }}&per_page={{ page_obj.paginator.per_page }}"
                            {% else %} href="#" {% endif %}>
                            <span aria-hidden="true">&rsaquo;</span>
                            <span class="sr-only">{% trans "Next" %}</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </td>
        <td colspan="2" class="text-right">
            <form method="get">
                Showing
                <select name="{{ per_page_param }}">
                    {% for value in per_page_values %}
                    {% with page_obj.paginator.per_page as per_page %}
                    <option value="{{ value }}" {% if value == per_page  %}selected{% endif %}>{{ value }}</option>
                    {% endwith %}
                    {% endfor %}
                </select>
                per page
                <input type="submit" value="apply" />
            </form>
        </td>
    </tr>
</tfoot>
