function paraPag($data) {
$chars = "<p> </p>"; // CHARACTERS TO REMOVE FROM LEFT AND RIGHT OF ORIGINAL TEXT
$text = trim($data, $chars);
$delimiter = "<br /><br />"; // COULD BE <BR><BR>, \n\r,
OR ANYTHING THAT APPEARS BETWEEN YOUR PARAGRAPHS
$paragraphs = explode($delimiter, $text);
$count = count($paragraphs); // GET THE COUNT OF PARAGRAPHS
$num_page = 10; // THE NUMBER OF PARAGRAPHS YOU WANT DISPLAYED ON EACH PAGE
$pages = ceil($count / $num_page); // GET THE NUMBER OF PAGES TOTAL
$output = ''; // INITIATE THE VARIABLE
// SET THE PAGE NUMBER
if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
}
$start = ($page * $num_page) - $num_page;
$end = ($page * $num_page) - 1;
// PRINT THE PAGE CONTENTS
for($i=$start; $i<=$end; $i++) {
if($i< $count) {
$output .= "<p>".$paragraphs[$i]."</p>\n";
}
}
// PRINT OUT THE PAGE NUMBERS
for($i=1; $i<=$pages; $i++) {
if($i == $page) {
$class = "class=\"activePage\"";
} else {
$class = 'class="page"';
}
$output .= "<a $class href=\"?page=$i\">$i</a> ";
}
return $output;
}