How to customize pager I have a code, that outputs a standard pager:

print theme('pager');


it outputs this:

&lt;h2 class="element-invisible"&gt;Pages&lt;/h2&gt;
&lt;div class="item-list"&gt;
&lt;ul class="pager"&gt;&lt;li class="pager-current first"&gt;1&lt;/li&gt;
&lt;li class="pager-item"&gt;&lt;a title="Go to page 2" href="/drupal/node?page=1"&gt;2&lt;/a&gt;&lt;/li&gt;
&lt;li class="pager-item"&gt;&lt;a title="Go to page 3" href="/drupal/node?page=2"&gt;3&lt;/a&gt;&lt;/li&gt;
&lt;li class="pager-next"&gt;&lt;a title="Go to next page" href="/drupal/node?page=1"&gt;next ›&lt;/a&gt;&lt;/li&gt;
&lt;li class="pager-last last"&gt;&lt;a title="Go to last page" href="/drupal/node?page=5"&gt;last »&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


How can I change the HTML to something like this:

&lt;ul class="pagination"&gt;
    &lt;li&gt;&lt;a href="#"&gt;&amp;lt;&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;1&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#" class="active"&gt;2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;3&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="#"&gt;&amp;gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


I looked into this thread: https://www.drupal.org/node/387786, created a function bartik_preprocess_custom_pager and a file custom-pager.tpl.php inside my Bartic theme templates, but I can't make it work.

print theme('custom_pager');


outputs nothing. Does anybody know, how can I customize the HTML output for a pager, creating one just for 1 page?
As pointed out in my comment above, most of the details are wrong in your implementation above. Fortunately in Drupal 7, there are six theming functions for the pager:


theme_pager()
theme_pager_first()
theme_pager_link()
theme_pager_last()
theme_pager_previous()
theme_pager_next()


These should allow you to make most of the customizations that you need. There's a good stackexchange answer about how to override Drupal theme functions() that you can refer to for the details.

Finally, you mentioned that you want to override the pager just for one page. I still think this might be worth doing with CSS alone, but in case it's not, you may be able to just override parts of the $variables array in whichever preprocess function contains the pager (I don't know off the top of my head if it's preprocess_page or preprocess_node or if it's accessible from any of the preprocess functions at all).