```ruby
module ApplicationHelper
def paginate(collection)
if collection.previous_page && !collection.next_page
will_paginate collection, :page_links => true, :next_label => "", :prev_label => "« Previous"
elsif collection.next_page && !collection.previous_page
will_paginate collection, :page_links => true, :next_label => "Next »", :prev_label => ""
else
will_paginate collection, :page_links => true, :next_label => "Next »", :prev_label => "« Previous"
end
end
end
```