Here is what I do:
I create an array containing all pages:
$valid_pages = array('page','page2','page3');
Then:
if (in_array ($page, $valid_pages))
{$result = 'OK';}
else
{errorinpage();}
or
if (in_array ($page, $valid_pages))
{$result = 'OK';}
else
{include(errorinpage.inc);}
Of course, in the first case you need to create a function called errorinpage(), which can, for example, include a nicely crafted 404 error page. The second example just "includes" the error page instead of calling a function.
If you have too many pages to list in an array, you could keep all "$pages" in one directory and use a native function (can't remember which now) to search the directory and check if $page exists.
Good luck,
Luciano ES
Santos, SP - Brasil