import Link from 'next/link'; interface IPagerProps { baseUrl: string; // Pass the base URL as a prop page: number; pageCount: number; } export default function Pager({ baseUrl, page, pageCount }: IPagerProps): React.JSX.Element { const pageNumbers = Array.from({ length: pageCount }, (_, i) => i + 1); const getPagePath = (page: any): string => { const pageNumber = parseInt(page); return `${baseUrl}/${pageNumber}`; }; const getNextPagePath = (page: any): string => { const pageNumber = parseInt(page); return `${baseUrl}/${pageNumber+1}`; } const getPreviousPagePath = (page: any): string => { const pageNumber = parseInt(page); return `${baseUrl}/${pageNumber-1}` } // Define the number of page links to show around the current page const maxPageLinksToShow = 3; // Calculate the range of page numbers to display const startPage = Math.max(1, page - Math.floor(maxPageLinksToShow / 2)); const endPage = Math.min(pageCount, startPage + maxPageLinksToShow - 1); return (