{% macro btn(link, expanded, icon, title, text, class) %}
<a {% if link %} href='{{link}}' {% endif %}
class='{{ expanded ? "flex row middle vt-5-in hz-15-in border border-success success p upper" : "icon border small radius-50 iflex col middle" }} {{not link ? "disabled"}} {{class}}' title='{{title}}'>
<i class='icon contain min {{icon}}'></i>
{% if expanded and not isMobile() %}
<span> {{text}}</span>
{% endif %}
</a>
{% endmacro %}
{% set expanded = expanded is defined and expanded ? true : false %}
{% if offset is defined and count is defined %}
{% if count > 0 %}
<div class='flex row space counters-box middle'>
{% set route = app.request.attributes.get('_route') %}
{% set pageRoute = route~'-page' %}
{% set route = isRoute(pageRoute) ? pageRoute : route %}
{% if table_limit is not defined %}
{% set table_limit = 20 %}
{% endif %}
{% set limit = (offset+1)*table_limit %}
{% set currentPath = path(app.request.attributes.get('_route'),app.request.attributes.get('_route_params')) %}
{% if limit > count %} {% set limit = count %} {% endif %}
{% if not expanded %}
<div class='right-20 adapt p'>
<label>Résultats : </label>
<b class="">{{ (offset*table_limit)+1 }} - {{ limit }} sur {{ count }}</b>
</div>
{% endif %}
{% set link = false %}
{% if (offset*table_limit)+1 > 1 %}
{% if params is defined and params|length %}
{% set params = params|merge({'offset':offset}) %}
{% set link = url(route,params) %}
{% elseif cat is defined and cat %}
{% set link = url(route,{'cat':cat,'offset':offset}) %}
{% else %}
{% set link = url(route,{'offset':offset}) %}
{% endif %}
{% endif %}
{{ _self.btn(link, expanded, "arrow-left", "Page précédente", "Précédent", "adapt right-5") }}
{% if expanded %}
<b class='btn btn-success small trans'>{{ (offset*table_limit)+1 }} - {{ limit }} sur {{ count }}</b>
{% endif %}
{% set link = false %}
{% if limit < count %}
{% if params is defined and params|length %}
{% set params = params|merge({'offset':offset+2}) %}
{% set link = url(route,params) %}
{% elseif cat is defined and cat %}
{% set link = url(route,{'cat':cat,'offset':offset+2}) %}
{% else %}
{% set link = url(route,{'offset':offset+2}) %}
{% endif %}
{% endif %}
{{ _self.btn(link, expanded, "arrow-right", "Page suivante", "Suivant", "adapt left-5 reverse") }}
</div>
{% else %}
<label>Aucune donnée trouvée</label>
{% endif %}
{% endif %}