How about:

```rb
      output = []
      link = '< rel="%s" href="%s" />'
      output << link % ["prev", url_for(:page => collection.previous_page, :only_path => false) if collection.previous_page
      output << link % ["next", url_for(:page => collection.next_page, :only_path => false) if collection.next_page
      output.join("\n").html_safe
```