table_alias('tur') ->selects([ 'tur.id', 'tur.username', 'c.fullname', 'c.phonenumber', 'c.email', 'tur.expiration', 'tur.time', 'tur.recharged_on', 'tur.recharged_time', 'tur.namebp', 'tur.routers' ]) ->join('tbl_customers', ['tur.customer_id', '=', 'c.id'], 'c') ->where_lte('expiration', $current_date) ->order_by_desc('expiration'); $expire = Paginator::findMany($query); // Get the total count of expired records for pagination $totalCount = ORM::for_table('tbl_user_recharges') ->where_lte('expiration', $current_date) ->count(); // Pass the total count and current page to the paginator $paginator['total_count'] = $totalCount; // Assign the pagination HTML to the template variable $ui->assign('expire', $expire); $ui->assign('cookie', $_COOKIE); return $ui->fetch('widget/customer_expired.tpl'); } }