{% set route = app.request.attributes.get('_route') %}
<nav>
    <ul class="pagination">
        <li class="page-item {{ page < 2 ? 'disabled' }}">
            <a class="page-link" href="{{ path(route, {'page': page - 1}) }}">Previous</a>
        </li>
        {% if page > 1 %}
            <li class="page-item">
                <a class="page-link" href="{{ path(route, {'page': page - 1}) }}">{{ page - 1 }}</a>
            </li>
        {% endif %}
        <li class="page-item active" aria-current="page">
            <a class="page-link">{{ page }}</a>
        </li>
        {% if page + 1 <= maxPage %}
            <li class="page-item">
                <a class="page-link" href="{{ path(route, {'page': page + 1}) }}">{{ page + 1 }}</a>
            </li>
        {% endif %}
        <li class="page-item {{ page + 1 > maxPage ? 'disabled' }}">
            <a class="page-link" href="{{ path(route, {'page': page + 1}) }}">Next</a>
        </li>
    </ul>
</nav>
