What is the main issue the user is facing with their PHP script regarding pagination?

The main issue the user is facing with their PHP script regarding pagination is that the pagination links are not displaying correctly or not working as expected. This could be due to incorrect calculation of total pages, offset calculation, or improper link generation for pagination. To solve this issue, the user needs to ensure that the total number of pages is calculated correctly based on the total number of items and items per page. Additionally, the offset calculation for fetching data from the database should be accurate. Finally, the pagination links should be generated properly with the correct page numbers.

// Calculate total number of pages
$total_pages = ceil($total_items / $items_per_page);

// Calculate offset for database query
$offset = ($current_page - 1) * $items_per_page;

// Generate pagination links
for ($i = 1; $i <= $total_pages; $i++) {
    echo "<a href='?page=$i'>$i</a> ";
}