What best practices should be followed when designing pagination systems in PHP web applications?

When designing pagination systems in PHP web applications, it is important to limit the number of items displayed per page to improve performance and user experience. Additionally, it is crucial to handle the logic for calculating the total number of pages based on the total number of items in the dataset. Finally, make sure to include navigation links to allow users to easily navigate between pages.

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

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