How do I use theme('pager')? I have problem to understand how I should use theme('pager') as explained on
EntityFieldQuery display pager.

I can't make it work (display pager and links to resulting pages).

Does pager(10) in EntityFieldQuery automatically invoke the pager? Should it be displayed with print(theme('pager'))?

Is this functionality included in Drupal core (7.15)?

I am doing my queries in template.php and injecting the query result in article.tpl.php through a variable.

As a workaround, I am thinking of doing two queries, one to find out what the number of nodes that meet a condition is, output links with numbering, attach the variable to those links, read the variable in another query and select the resulting nodes with range($i,$j).
Does pager(10) in EntityFieldQuery automatically invoke the pager?


Yes; it even avoids the usual problem of multiple pagers on a single page conflicting, by getting a new delta from the PagerDefault class.


  Should it be displayed with print(theme('pager'))?


Yes (but obviously only if there is more than one page worth of results to display).


  Is this functionality included in Drupal core (7.15)?


Yes.

This works perfectly for me:

$query = new EntityFieldQuery;
$query-&gt;entityCondition('entity_type', 'node')
  -&gt;pager(10);

$results = $query-&gt;execute();
$nodes = node_load_multiple(array_keys($results['node']));

$build = array(
  'nodes' =&gt; node_view_multiple($nodes),
  'pager' =&gt; array(
    '#theme' =&gt; 'pager',
  )
);


That's returned from a menu callback function, so will be passed through drupal_render(). When it does so, a list of node teasers is displayed with the expected pager right below.

If the same example doesn't work for you then there must be something wrong with your installation, or something in a custom/contributed module conflicting with the core pager system.