Where is $pagenum set? If you're expecting it to come from a form value or URL query string, then you should reference it as $POST['pagenum'] or $GET['pagenum'] as applicable, since you should not count on register_globals being activated (especially since it is not the default setting any more).
PS: copying your code into your post between [ php] and [/php ] tags (without the spaces I typed here), instead of an external link to a PDF file, will make life easier on those who want to view your code.