Numbered pagination showing all numbers instead of paginated blocks

You did enter total number of posts/events as total page count. you should have passed total number of pages instead of total pages as “total” args. So to pass as total pages, you should calculate like TOTAL_POSTS/PER_PAGE.. so if you have 6 posts and you have 2 posts per page then it would be 6/2=3 pages.. so the “total” value should have been 3.. if you have 7 posts.. then it would be 7/2=3.5=4 pages.. PHP ceil function does that trick to round off to highest value.

So part of your code should be

$total=ceil($mycats[0]->category_count/$my_per_page);

Where $my_per_page would be your Per Page variable.

I hope this fixes your issue