How do I change total number of rows in a view programmatically?
You're probably looking for the view::set_items_per_page() method, e.g.

/**
 * Implements hook_views_pre_build 
 **/
function MYMODULE_views_pre_build(&amp;$view) {
  if ($view-&gt;name == 'foo') {
    $view-&gt;set_items_per_page(10);
  }
}


That method updates both the instance var and the limit on the internal query that Views will eventually run.

Note that you need to make this change before the query is executed (i.e. in a pre build, not pre render, hook), or you'll get inconsistencies with pagers etc.