<?php
if (!$user->isAuth()) {
redirect('/');
exit;
}
$all = $db->prepare('SELECT * FROM `users_sessions` WHERE `user_id` = ? ORDER BY `created_at` DESC');
$all -> execute([$user->get()->user_id]);
$all = $all -> fetchAll();
$peger = new ArrayPaginator('/history', 10);
$items = $peger->getItems($all);
echo $template->render('user.history',
['peger' => $peger,
'items' => $items
]
);