title: php handling pagination $_GET requests past limit
body: <p>I have a template page that paginates through results with a <code>$_GET</code> request.</p>
  
  <p>How should I handle any <code>$_GET</code> errors where a user vists a page that would exceed the total number of avaliable results?</p>
  
  <p>I've thought of the following solutions but I'm not sure which is the ideal choice:</p>
  
  <ul>
  <li>404 - display 404 error message</li>
  <li>301/2 redirect back to the last available page of results</li>
  <li>Alter the data request to show the last available batch of results (not a redirect) </li>
  <li>301/2 redirect back to the first page</li>
  <li>Just display an 'no results' message (not a redirect)</li>
  </ul>
  
  <p>I'll need to take into considering that the total number of results may increase or decrease over time. Meaning <code>my-page.php?p=3</code> may or may not display results.</p>
  
  <p>I'm also wonder if I need to consider the possibility of a user or bot spaming my template with <code>$_GET</code> for any page number <code>my-page.php?p=9999999</code>, or am I overthinking this ?</p>
  
  <p>Thanks</p>