Skip to content
This repository was archived by the owner on Mar 20, 2018. It is now read-only.
This repository was archived by the owner on Mar 20, 2018. It is now read-only.

Negative page parameter causes Internal Server Error #49

@ePirat

Description

@ePirat

Specifying a negative value for the page GET parameter on the blog page will cause an internal server error, example:
http://schnitzelpress.org/blog/?page=-1

This can be fixed by checking in render_blog in blog.rb:

def render_blog
    total_count   = Post.latest.count
    skipped_count = (params[:page].to_i > 0) ? (params[:page].to_i * 10) : 0
    @posts = Post.latest.skip(skipped_count).limit(10)

    displayed_count = @posts.count(true)
    @show_previous_posts_button = total_count > skipped_count + displayed_count

    render_posts
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions