Fixed TEMPLATE_PAGINATION feature

The pagination setting to use should be based on the template name,
not the name of the output file which will be created. I mangled this
during rebasing.