I need to filter the unreliable $_SERVER['PHP_SELF'] varialbe. Is this a good approach:
function filterPhpSelf($str) 
{
    $phpself = basename(__FILE__);
    $str = substr($str, 0, strpos($str,$phpself)) . $phpself;
    return $unsafeStr;
}
where $str is $_SERVER['PHP_SELF']?