$data = [
[
'first' => 'first1',
'second' => 'vovka'
],
[
'first' => 'tester',
'second' => 'tester1'
],
[
'first' => 'dfdf',
'second' => 'dd'
],
[
'first' => 'we',
'second' => 'www'
],
[
'first' => '1',
'second' => '2'
]
];
$current_page = 2;
$limit = 2;
$total = sizeof($data);
$count_page = ceil($total / $limit);
$n = ($current_page * $limit) - $limit;
if($current_page<1 || $current_page>$count_page) exit("Такой страницы нет");
$content = [];
$pagination = [];
for($i=$n; $i<($n+$limit); $i++){
if($i>=$total) break;
$content[] = $data[$i];
}
if($count_page>1)
for($i=1; $i<=$count_page; $i++){
$pagination[] = $i;
}
print_r([$pagination,$content]);