Off the top of my head you could try something like
$pagecount = <?php echo ($_GET['pgx']-40); ?>
and then use $pagecount as your chargeable page count variable.
Or if you wanted to put it into a session value
$_SESSION['pagecount'] = <?php echo ($_GET['pgx']-40); ?>
Let me know if that works out.