@php $btnBase = 'inline-flex cursor-pointer select-none items-center justify-center gap-2 font-medium transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background'; $btnSm = 'min-w-[2.25rem] rounded-md px-3 py-1.5 text-xs'; $primary = "{$btnBase} {$btnSm} bg-brand text-brand-foreground shadow-sm hover:bg-brand/90"; $secondary = "{$btnBase} {$btnSm} border border-border bg-card text-card-foreground shadow-sm hover:bg-muted"; $disabled = 'pointer-events-none cursor-not-allowed opacity-50'; $currentPage = $paginator->currentPage(); $lastPage = $paginator->lastPage(); $visiblePages = []; // Always include first two pages $visiblePages[] = 1; if ($lastPage >= 2) { $visiblePages[] = 2; } // Always include last two pages if ($lastPage >= 3) { if ($lastPage - 1 > 2) { $visiblePages[] = $lastPage - 1; } $visiblePages[] = $lastPage; } // Middle range based on current page if ($currentPage >= $lastPage - 2) { // We are near the end (last page, second last, or third last) $start = max(1, $currentPage - 3); for ($i = $start; $i <= $lastPage; $i++) { $visiblePages[] = $i; } } else { // We are near the beginning or middle $end = min($lastPage, $currentPage + 3); for ($i = $currentPage; $i <= $end; $i++) { $visiblePages[] = $i; } } // Remove duplicates and sort $visiblePages = array_unique($visiblePages); sort($visiblePages); @endphp @if ($paginator->hasPages())
{!! __('pages/common.showing_to_of_results', [ 'from' => '' . $paginator->firstItem() . '', 'to' => '' . $paginator->lastItem() . '', 'total' => '' . $paginator->total() . '', ]) !!}