How can the code snippet be modified to better handle pagination of search results in PHP?

The code snippet can be modified to handle pagination of search results by adding logic to calculate the limit and offset values based on the current page number and the number of results to display per page. This will allow the search results to be displayed in multiple pages rather than all at once.

// Calculate limit and offset values for pagination
$limit = 10; // Number of results to display per page
$page = isset($_GET['page']) ? $_GET['page'] : 1; // Get current page number, default to 1
$offset = ($page - 1) * $limit; // Calculate offset based on current page number

// Modify SQL query to include limit and offset values
$sql = "SELECT * FROM search_results LIMIT $limit OFFSET $offset";

// Execute SQL query and display search results
// Code to execute query and display results goes here