title: Is this sanitization ok/enough for a page redirection using $_GET?
body: <p>I'm using $_get for a simple page redirection.
  I've only just started learning about sanitizing user input, so I was wondering if the below code was ok. Is there any other sanitization that is recommended for this particular code? If yes, why?</p>
  
  <p>About the code below. I checked that the user entered a value and then matched the value against a list of acceptable values before redirecting.</p>
  
  <pre><code>$host  = $_SERVER['HTTP_HOST'];
  $uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
  $PAGES = array('a', 'b', 'c', 'd', 'z');
  
  if (empty($_GET['letter'])) { 
  $_GET['letter']="a";
  }
  
  if (!in_array($_GET['letter'], $PAGES)) { 
  $_GET['letter']="a";  
  }
  
  $letter=$_GET['letter']; 
  $goto=$letter .".php";
  header("Location: http://$host$uri/$goto");
  </code></pre>