
$totalItems = 100;
$itemsPerPage = 10;
$currentPage = 5;

$pagination = new Pagination($totalItems, $itemsPerPage, $currentPage);

$url = 'http://example.com/page';

echo $pagination->generateNextPrevLinks($url);
echo $pagination->generateEllipsesLinks($url);


public function findAllByWithPagination(array $conditions, $page = null, $perPage, $orderByColumn, $orderDirection = 'asc')
{
    // ... (previous code)

    // Create a CustomPaginator instance
    $paginator = new CustomPaginator($totalCount, $perPage, $page);

    // Get the current URL (you may need to adjust this based on your framework)
    $currentUrl = $_SERVER['PHP_SELF'];

    // Generate pagination links
    $paginationLinks = $paginator->generateLinks($currentUrl);

    return [
        'data' => $data,
        'total' => $totalCount,
        'page' => $page,
        'perPage' => $perPage,
        'paginator' => $paginator,
        'paginationLinks' => $paginationLinks,
    ];
}