<?php if ($attachment_before): ?> <div class="attachment-before"> <?php print $attachment_before; ?> </div> <?php endif; ?>Insert the following code after it (this is copied directly from the same code at the bottom of the tpl):
<?php if ($pager): ?> <?php print $pager; ?> <?php endif; ?>