Change views pager programmatically I'm adding nodes to a view programmatically and i'm altering the pager 'x out of y' by setting the folowing in hook_views_pre_render:

$view-&gt;query-&gt;pager-&gt;total_items = $count;
$view-&gt;query-&gt;pager-&gt;current_page = isset($params['page']) ? $params['page'] : 0;
$view-&gt;query-&gt;pager-&gt;options['total_pages'] = ceil( $count / $lim );
$view-&gt;total_rows = (string) $count;
$view-&gt;items_per_page = (string) $view-&gt;query-&gt;pager-&gt;options['items_per_page'];
$view-&gt;current_page =isset($params['page']) ? $params['page'] : 0;


Let's say there are 10 pages but even with this code nothing seems to happen, nothing get's altered. When on the second page, it doesn't display the next button. How can this achieved with code? What object, array should i alter to have this result?
Any help would be appreciated.

Thanks
Try some thing like this and see if it helps

function views_pag_views_pre_build(&amp;$view) {
    if ($view-&gt;name == "pagination") {
            $view-&gt;init_pager();
            $view-&gt;set_items_per_page('10');

    }
}