Clean up get_last_page()

This commit is contained in:
swag 2021-12-25 01:46:39 -05:00
parent 89712d81a8
commit 328e1f4d4d

View File

@ -50,15 +50,11 @@ sub max_posts($self, $value = undef) {
}
sub get_last_page($self) {
my $post_count = get_post_count($self);
my $post_count = $self->get_post_count();
my $last_page = sprintf('%d', $post_count / $self->{'max_posts'});
# Add a page if we have "remainder" posts
if ($post_count % $self->{'max_posts'}) {
sprintf('%d', $post_count / $self->{'max_posts'}) + 1
}
else {
sprintf('%d', $post_count / $self->{'max_posts'})
}
return $post_count % $self->{'max_posts'} ? ++$last_page : $last_page;
}
sub get_post_count($self) {