{% if pageCount > 1 %}
  <div class="flex items-center justify-between bg-white px-2 py-1">
    <div class="flex flex-1 flex-col items-center gap-4">
      <div>
        <nav class="isolate inline-flex -space-x-px rounded-md text-xs shadow-xs" aria-label="Pagination">
          {% if first is defined and current != first %}
            <a
              data-action="live#action"
              data-live-action-param="debounce(300)|paginateTo"
              data-live-page-param="{{ first }}"
              class="relative inline-flex cursor-pointer items-center rounded-l-md px-2 py-2 text-gray-800 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">First</span>
              <div class="icon-chevrons-left"></div>
            </a>
            <a
              data-action="live#action"
              data-live-action-param="debounce(300)|paginateTo"
              data-live-page-param="{{ previous }}"
              class="relative inline-flex cursor-pointer items-center px-2 py-2 text-gray-800 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">Previous</span>
              <div class="icon-chevron-left"></div>
            </a>
          {% else %}
            <button
              class="relative inline-flex items-center rounded-l-md px-2 py-2 text-gray-400 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">First</span>
              <div class="icon-chevrons-left"></div>
            </button>
            <button
              class="pointer-events-none relative inline-flex items-center px-2 py-2 text-gray-400 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">Previous</span>
              <div class="icon-chevron-left"></div>
            </button>
          {% endif %}
          {% for page in pagesInRange %}
            {% if page != current %}
              <a
                data-action="live#action"
                data-live-action-param="debounce(300)|paginateTo"
                data-live-page-param="{{ page }}"
                class="relative inline-flex cursor-pointer items-center px-4 py-2 font-semibold text-gray-900 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
                {{- page -}}
              </a>
            {% else %}
              <li
                aria-current="page"
                class="bg-primary focus-visible:outline-primary relative z-10 inline-flex items-center px-4 py-2 font-semibold text-white focus:z-20 focus-visible:outline-2 focus-visible:outline-offset-2">
                {{ page }}
              </li>
            {% endif %}
          {% endfor %}

          {% if next is defined %}
            <a
              data-action="live#action"
              data-live-action-param="debounce(300)|paginateTo"
              data-live-page-param="{{ next }}"
              class="relative inline-flex cursor-pointer items-center px-2 py-2 text-gray-900 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">Next</span>
              <div class="icon-chevron-right"></div>
            </a>
          {% else %}
            <button
              class="relative inline-flex items-center px-2 py-2 text-gray-400 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">Next</span>
              <div class="icon-chevron-right"></div>
            </button>
          {% endif %}
          {% if last is defined and current != last %}
            <a
              data-action="live#action"
              data-live-action-param="debounce(300)|paginateTo"
              data-live-page-param="{{ last }}"
              class="relative inline-flex cursor-pointer items-center rounded-r-md px-2 py-2 text-gray-700 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">Last</span>
              <div class="icon-chevrons-right"></div>
            </a>
          {% else %}
            <button
              class="relative inline-flex items-center rounded-r-md px-2 py-2 text-gray-400 ring-1 ring-gray-300 ring-inset hover:bg-gray-50 focus:z-20 focus:outline-offset-0">
              <span class="sr-only">Next</span>
              <div class="icon-chevrons-right"></div>
            </button>
          {% endif %}
        </nav>
      </div>
      <div>
        <p class="text-sm text-gray-700">
          <span class="font-medium">{{ (current - 1) * numItemsPerPage + 1 }}</span>
          {{ 'pagination.to'|trans([],'serenity_admin_messages') }}
          <span class="font-medium">{{ min(current * numItemsPerPage, totalCount) }}</span>
          {{ 'pagination.of'|trans([],'serenity_admin_messages') }}
          <span class="font-medium">{{ totalCount }}</span>
          {{ 'pagination.results'|trans([],'serenity_admin_messages') }}
        </p>
      </div>
    </div>
  </div>
{% endif %}
