<?php
$queryParams = [];
if (!empty($searchQuery)) $queryParams['search'] = $searchQuery;
if (!empty($searchStatus)) $queryParams['status'] = $searchStatus;
if (!empty($searchSort)) $queryParams['sort'] = $searchSort;
$queryString = !empty($queryParams) ? '&' . http_build_query($queryParams) : '';
?>

<div class="pagination">
    <?php if($currentPage > 1): ?>
        <a href="<?php echo e(route('admin.panel')); ?>?page=1<?php echo e($queryString); ?>">&laquo; First</a>
        <a href="<?php echo e(route('admin.panel')); ?>?page=<?php echo e($currentPage - 1); ?><?php echo e($queryString); ?>">&lsaquo; Prev</a>
    <?php endif; ?>

    <?php
    $start = max(1, $currentPage - 2);
    $end = min($totalPages, $currentPage + 2);
    ?>

    <?php for($i = $start; $i <= $end; $i++): ?>
        <?php if($i == $currentPage): ?>
            <span class="current"><?php echo e($i); ?></span>
        <?php else: ?>
            <a href="<?php echo e(route('admin.panel')); ?>?page=<?php echo e($i); ?><?php echo e($queryString); ?>"><?php echo e($i); ?></a>
        <?php endif; ?>
    <?php endfor; ?>

    <?php if($currentPage < $totalPages): ?>
        <a href="<?php echo e(route('admin.panel')); ?>?page=<?php echo e($currentPage + 1); ?><?php echo e($queryString); ?>">Next &rsaquo;</a>
        <a href="<?php echo e(route('admin.panel')); ?>?page=<?php echo e($totalPages); ?><?php echo e($queryString); ?>">Last &raquo;</a>
    <?php endif; ?>
</div>
<?php /**PATH /home/codexgen.my.id/laravel/resources/views/admin/partials/pagination.blade.php ENDPATH**/ ?>