diff --git a/seahub/templates/repo_history.html b/seahub/templates/repo_history.html
index d89871e4d9..84893f9c93 100644
--- a/seahub/templates/repo_history.html
+++ b/seahub/templates/repo_history.html
@@ -54,9 +54,9 @@
{% if page_next %}
{% trans "Next"%}
{% endif %}
- {% if current_page != 1 or page_next %}
- |
- {% endif %}
+ {% if current_page != 1 or page_next %}
+ |
+ {% endif %}
{% trans "Per page: "%}
{% if per_page == 25 %}
25
diff --git a/seahub/templates/repo_view_snapshot.html b/seahub/templates/repo_view_snapshot.html
index fcbced8449..bc984e0876 100644
--- a/seahub/templates/repo_view_snapshot.html
+++ b/seahub/templates/repo_view_snapshot.html
@@ -47,10 +47,13 @@
{% if current_page != 1 %}
-
{% trans "Previous"%} |
+
{% trans "Previous"%}
{% endif %}
{% if page_next %}
-
{% trans "Next"%} |
+
{% trans "Next"%}
+ {% endif %}
+ {% if current_page != 1 or page_next %}
+ |
{% endif %}
{% trans "Per page: "%}
{% if per_page == 25 %}
diff --git a/seahub/views/__init__.py b/seahub/views/__init__.py
index 8cd2f68d23..fef2cdfb7b 100644
--- a/seahub/views/__init__.py
+++ b/seahub/views/__init__.py
@@ -655,7 +655,7 @@ def repo_view_snapshot(request, repo_id):
# don't show the current commit
commits_all = get_commits(repo_id, per_page * (current_page -1) + 1,
- per_page + 2)
+ per_page + 1)
commits = commits_all[:per_page]
if len(commits_all) == per_page + 1: