"how is
$1 changing during a simple function call?" –$1 inside the function comes from the arguments of the function. Now it seems that for some reason $page expands to manman in the line 1397. Investigate where this value of $page comes from.