I loaded your script onto my server and I had some issues with it. There isn't a whole lot of checking to see if pages even exist. I think it also assumes how many items are in the array. One more thing, if you added an odd amount of data it wouldn't show it all. I rewrote it though based off some code I use, added a few things to it. Try it out, take a look at how it works.
//page.php
<?
session_start();//start session for this page
$array = $_SESSION['arrayData'];
$page = $_REQUEST['pagenum'];
$currentpage = isset($page) ? (integer)$page : 1;
$numperpage = 10; //number of records per page
$total = count($_SESSION['arrayData']);
$numofpages = ceil($total / $numperpage); //total num of pages, oh yeah don't forget to round up
if(isset($array)){
if (($currentpage > 0) && ($currentpages <= $numofpages)) {
//yes pages are required and current page is ok
//show data array
$start = ($currentpage-1) * $numperpage;
for($i=$start;$i<=($numperpage+$start-1);$i++) {
if (isset($array[$i]))
echo $array[$i] .'<br />';
}
if ($currentpage != 1) {//can't go back from page 1
$previous_page = $currentpage - 1;
$previous = '<a href="page.php?pagenum='. $previous_page .'"><< Previous</a> ';
}
$pages_html = ' Pages: ';
for ($a=1; $a<=$numofpages; $a++) {
if ($a == $currentpage) {
$pages_html .= $a .'</u>, ';
} else {
$pages_html .= '<a href="page.php?pagenum='. $a .'" >'. $a .'</a>, ';
}
}
$pages_html = substr($pages_html,0,-2); //remove the last ,
if ($currentpage != $numofpages) {//can't go forward if we are on the last page
$next_page = $currentpage + 1;
$next = ' <a href="page.php?pagenum='. $next_page .'">Next >></a>';
}
echo '<br /><br />'. $previous . $pages_html . $next; //hyperlinks controls
}
if (isset($_REQUEST['destroy']))
session_destroy();
}else{
$arrayData = array();
for($x=0;$x<104;$x++){ //fill array data
$arrayData[] = "number: $x";
}
$_SESSION['arrayData'] = $arrayData; //register it with session
header("Location: {$_SERVER['PHP_SELF']}");
}
?>