I would simplify that query. The group by element is taking all those items and condensing it to 1 row 🙁 So even if the script did work, you'd only ever see 1 page 🙁
The reason it returns 0 is because you forgot the "$" in front of "category_count" in the ceil() function.
Here's how I would do it:
<?php
$data = mysql_fetch_row(mysql_query("SELECT COUNT(*) AS `count` FROM `jokedata` WHERE `jokecategory` = '{$cur_category}'"));
$pages = ceil($data['count'] / $jokes_per_page);
That should get you a number that's work-able. If you table has a primary key defined (which they should for optimization reasons) then COUNT(*) is just as efficient as COUNT(columnName). If you don't have a primary key defined, use COUNT(columnName) instead 😉