assuming that you are not interested in HTTP_REFERER, this is what i thought of for *nix to just get the page.ext... maybe someone else has a better idea.
$page = split("/", getenv(SCRIPT_NAME));
$n = count($page)-1;
$page = $page[$n];
$page = split("\.", $page, 2);
$ext = $page[1];
$page = $page[0];
$script = "$page.$ext";
note that $script will be first_page.php so, if you want, just dump $script in a session.