Pager not displaying I am having problems getting a pager to display after a table in the block_view hook of a module

The code for the query is the following one.

$query = db_select('registry', 'r');
$query = $query-&gt;extend('PagerDefault')-&gt;extend('TableSort');

$query-&gt;limit(10)
    -&gt;fields('r', array('name', 'type', 'filename','module','weight'));
$result = $query-&gt;execute();


I build and the table with no problem adding it to the content

Then I add the pager or rather I don't with the following code

$block['content'] .= theme('pager').'&lt;br&gt;mmm&lt;br&gt;';


the mmm bit was just there as a quick check to see what was happening.

I know that the extend needs to be assigned to a new variable and I believe that I am doing this. 

Is there anything wrong I am doing?

This is the complete code of the module.  

/**
 * @file
 * A block module that displays registry info.
 */

/**
 * Implements hook_help.
 *
 * Displays help and module information.
 *
 * @param path 
 *   Which path of the site we're using to display help
 * @param arg 
 *   Array that holds the current path as returned from arg() function
 */
function current_posts_help($path, $arg) {
  switch ($path) {
    case "admin/help#current_posts":
    return '&lt;p&gt;' . t("Displays registry info for testing tables and pager") . '&lt;/p&gt;';
    break;
  }
} 

/**
 * Implements hook_block_info().
 */
function current_posts_block_info() {
  $blocks['current_posts'] = array(
    'info' =&gt; t('Current posts'), //The name that will appear in the block list.
    'cache' =&gt; DRUPAL_CACHE_PER_ROLE, //Default
  );
  return $blocks;
}

function current_posts_block_view($delta = '') {
  switch($delta) {
    case 'current_posts':
      $block['subject'] = t('Modules list');
      if(user_access('access content')) {
        $query = db_select('registry', 'r');
        $query = $query-&gt;extend('PagerDefault');
        //$result = $query-&gt;limit(50)
        $query-&gt;limit(10)
          -&gt;fields('r', array('name', 'type', 'filename','module','weight'));
        $result = $query-&gt;execute();

        // Array to contain items for the block to render.

        $rows = array();

        // Iterate over the resultset. 
        foreach ($result as $node) {
          $rows[] = array(
            'name' =&gt; t($node-&gt;name),
            'type' =&gt; t($node-&gt;type),
            'filename' =&gt; t($node-&gt;filename),
            'module' =&gt; t($node-&gt;filename),
          );
        }

        // Table header.
        $header = array(
          'name' =&gt; t('Name'),
          'type'     =&gt; t('Type'),
          'filename'    =&gt; t('Filename'),
          'module'    =&gt; t('Module'),
        );

        $block['content'] = theme('table', array(
          'header'  =&gt; $header,
          'rows'    =&gt; $rows,
          'id'      =&gt; 'table-articles',
          'class'   =&gt; 'articles',)
        );

        $block['content'] .= theme('pager').'&lt;br&gt;mmm&lt;br&gt;';
      }

      return $block;        
  }
}

/**
 * Implements hook_menu().
 */
function current_posts_menu() {
  $items = array();

  $items['admin/config/content/current_posts'] = array(
    'title' =&gt; 'Current Registry',
    'description' =&gt; 'Configuration for Current posts module',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('current_posts_form'),
    'access arguments' =&gt; array('access administration pages'),
    'type' =&gt; MENU_NORMAL_ITEM,
  );

  return $items;
}

/**
 * Page callback: Current posts settings
 *
 * @see current_posts_menu()
 */
function current_posts_form($form, &amp;$form_state) {
  $form['current_posts_max'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; t('Maximum number of posts'),
    '#default_value' =&gt; variable_get('current_posts_max', 3),
    '#size' =&gt; 2,
    '#maxlength' =&gt; 2,
    '#description' =&gt; t('The maximum number of links to display in the block.'),
    '#required' =&gt; TRUE,
  );

  return system_settings_form($form);
}
I think I know what is going on. I've had this problem several times before.

The issue is that on some pages, multiple pagers may be in use. Which would explain why theme('pager'); wouldn't work.

I just had the same problem, and I got it working by doing this: 

theme('pager', array('element' =&gt; 1));


On my end, I wasn't displaying multiple pagers, but I think something else on the page must have been doing this, because the above code made it work! I hope this helps anyone else who encounters the same problem.