Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Return 404 for out of bounds archive pages. Fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
rgrove committed Jul 14, 2009
1 parent 222333c commit 24c99a1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/thoth/controller/archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ class ArchiveController < Controller

def index(page = 1)
page = page.to_i
page = 1 unless page >= 1
error_404 unless page >= 1

@posts = Post.recent(page, 10)

if page > @posts.page_count && @posts.page_count > 0
page = @posts.page_count
@posts = Post.recent(page, 10)
end
error_404 if page > @posts.page_count && @posts.page_count > 0

@title = "#{Config.site['name']} Archives (page #{page} of " <<
"#{@posts.page_count > 0 ? @posts.page_count : 1})"
Expand Down

0 comments on commit 24c99a1

Please sign in to comment.