<div class="ui pagination menu">
    <a
        href="{{ getRouteUrl('members', {'offset': 1, 'type': userType, 'search': request.query.search}) }}"
        class="item pagination-first {% if currentPage == 1 %}disabled{% endif %}"
    >{{ translate('First') }}</a>
    <a
        href="{{ getRouteUrl('members', {'offset': max(currentPage - 1, 1), 'type': userType, 'search': request.query.search}) }}"
        class="item pagination-prev {% if currentPage == 1 %}disabled{% endif %}"
    >{{ translate('Prev') }}</a>
    {% for i in range(max(currentPage - 2, 1), min(currentPage + 2, totalPages)) %}
        <a
            href="{{ getRouteUrl('members', {'offset': i, 'type': userType, 'search': request.query.search}) }}"
            class="item {% if currentPage == i %}active{% endif %}"
        >{{ i }}</a>
    {% endfor %}
    <a
        href="{{ getRouteUrl('members', {'offset': min(currentPage + 1, totalPages), 'type': userType, 'search': request.query.search}) }}"
        class="item pagination-next {% if currentPage == totalPages %}disabled{% endif %}"
    >{{ translate('Next') }}</a>
    <a
        href="{{ getRouteUrl('members', {'offset': totalPages, 'type': userType, 'search': request.query.search}) }}"
        class="ui item pagination-last {% if currentPage == totalPages %}disabled{% endif %}"
    >{{ translate('Last') }}</a>
</div>