{"action":"created","comment":{"url":"https://api.github.com/repos/solute/pyramid_epfl/pulls/comments/38629157","id":38629157,"diff_hunk":"@@ -14,30 +14,31 @@\n             <li class=\"{{ '' if compo.row_offset > 0 else 'disabled' }}\">\n                 <span aria-hidden=\"true\">&lt;</span>\n             </li>\n-            {% if max_page > 4 %}\n-            \t{% if (max_page-current_page) < 2 %}\n-            \t\t{% set pagination_start = (((compo.row_count/compo.row_limit)|round(method='floor')|int)-4)*compo.row_limit %}\n-            \t\t{% set pagination_end = compo.row_count %}\n-            \t{% elif current_page < 3 %}\n-            \t\t{% set pagination_start = 0 %}\n-            \t\t{% set pagination_end = 5*compo.row_limit %}\n-            \t{% else %}\n-            \t\t{% set pagination_start = (current_page-2)*compo.row_limit %}\n-            \t\t{% set pagination_end = (current_page+3)*compo.row_limit %}\n-            \t{% endif %}\n+            {% if max_page > (compo.number_of_pagination_pages-1) %}\n+                {% set pages_before_and_after_current_page = ((compo.number_of_pagination_pages/2)|round(method='ceil')|int)-1 %}\n+                {% if (max_page-current_page) < pages_before_and_after_current_page %}\n+                    {% set pagination_start = (max_page-(compo.number_of_pagination_pages-1))*compo.row_limit %}\n+                    {% set pagination_end = compo.row_count %}\n+                {% elif current_page < (compo.number_of_pagination_pages-pages_before_and_after_current_page) %}\n+                    {% set pagination_start = 0 %}\n+                    {% set pagination_end = compo.number_of_pagination_pages*compo.row_limit %}\n+                {% else %}\n+                    {% set pagination_start = (current_page-pages_before_and_after_current_page)*compo.row_limit %}\n+                    {% set pagination_end = (current_page+pages_before_and_after_current_page+1)*compo.row_limit %}\n+                {% endif %}\n             {% else %}\n-            \t{% set pagination_start = 0 %}\n-            \t{% set pagination_end = compo.row_count %}\n+                {% set pagination_start = 0 %}\n+                {% set pagination_end = compo.row_count %}\n             {% endif %}\n             {% for i in range(pagination_start, pagination_end, compo.row_limit) %}\n-\t            <li class=\"{{ 'active' if i == compo.row_offset else '' }}\">\n-\t                <span>{{ (i/compo.row_limit + 1)|round(method='ceil')|int }}</span>\n-\t            </li>\n-\t        {% endfor %}\n+                <li class=\"{{ 'active' if i == compo.row_offset else '' }}\">\n+                    <span>{{ (i/compo.row_limit + 1)|round(method='ceil')|int }}</span>\n+                </li>\n+            {% endfor %}\n             <li class=\"{{ '' if compo.row_offset + compo.row_limit < compo.row_count else 'disabled' }}\">\n                 <span aria-hidden=\"true\">&gt;</span>\n             </li>\n-            {% if max_page > 4 %}\n+            {% if max_page > (compo.number_of_pagination_pages-1) %}","path":"solute/epfl/components/paginated_list_layout/theme/after.html","position":58,"original_position":58,"commit_id":"cd08e48cabacba02eb050199746c38485ce074c7","original_commit_id":"cd08e48cabacba02eb050199746c38485ce074c7","user":{"login":"JustusW","id":1852088,"avatar_url":"https://avatars.githubusercontent.com/u/1852088?v=3","gravatar_id":"","url":"https://api.github.com/users/JustusW","html_url":"https://github.com/JustusW","followers_url":"https://api.github.com/users/JustusW/followers","following_url":"https://api.github.com/users/JustusW/following{/other_user}","gists_url":"https://api.github.com/users/JustusW/gists{/gist_id}","starred_url":"https://api.github.com/users/JustusW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustusW/subscriptions","organizations_url":"https://api.github.com/users/JustusW/orgs","repos_url":"https://api.github.com/users/JustusW/repos","events_url":"https://api.github.com/users/JustusW/events{/privacy}","received_events_url":"https://api.github.com/users/JustusW/received_events","type":"User","site_admin":false},"body":"spaces before and after - please.","created_at":"2015-09-03T09:49:35Z","updated_at":"2015-09-03T09:49:35Z","html_url":"https://github.com/solute/pyramid_epfl/pull/108#discussion_r38629157","pull_request_url":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108","_links":{"self":{"href":"https://api.github.com/repos/solute/pyramid_epfl/pulls/comments/38629157"},"html":{"href":"https://github.com/solute/pyramid_epfl/pull/108#discussion_r38629157"},"pull_request":{"href":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108"}}},"pull_request":{"url":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108","id":44085861,"html_url":"https://github.com/solute/pyramid_epfl/pull/108","diff_url":"https://github.com/solute/pyramid_epfl/pull/108.diff","patch_url":"https://github.com/solute/pyramid_epfl/pull/108.patch","issue_url":"https://api.github.com/repos/solute/pyramid_epfl/issues/108","number":108,"state":"open","locked":false,"title":"paginated list layout: made number of pages shown in paginated bar","user":{"login":"mhauck","id":4542487,"avatar_url":"https://avatars.githubusercontent.com/u/4542487?v=3","gravatar_id":"","url":"https://api.github.com/users/mhauck","html_url":"https://github.com/mhauck","followers_url":"https://api.github.com/users/mhauck/followers","following_url":"https://api.github.com/users/mhauck/following{/other_user}","gists_url":"https://api.github.com/users/mhauck/gists{/gist_id}","starred_url":"https://api.github.com/users/mhauck/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhauck/subscriptions","organizations_url":"https://api.github.com/users/mhauck/orgs","repos_url":"https://api.github.com/users/mhauck/repos","events_url":"https://api.github.com/users/mhauck/events{/privacy}","received_events_url":"https://api.github.com/users/mhauck/received_events","type":"User","site_admin":false},"body":"configurable","created_at":"2015-09-03T09:32:30Z","updated_at":"2015-09-03T09:49:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90e3faf57317c61ad1a8ed6a3dbd2c66401da07f","assignee":{"login":"JustusW","id":1852088,"avatar_url":"https://avatars.githubusercontent.com/u/1852088?v=3","gravatar_id":"","url":"https://api.github.com/users/JustusW","html_url":"https://github.com/JustusW","followers_url":"https://api.github.com/users/JustusW/followers","following_url":"https://api.github.com/users/JustusW/following{/other_user}","gists_url":"https://api.github.com/users/JustusW/gists{/gist_id}","starred_url":"https://api.github.com/users/JustusW/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JustusW/subscriptions","organizations_url":"https://api.github.com/users/JustusW/orgs","repos_url":"https://api.github.com/users/JustusW/repos","events_url":"https://api.github.com/users/JustusW/events{/privacy}","received_events_url":"https://api.github.com/users/JustusW/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108/commits","review_comments_url":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108/comments","review_comment_url":"https://api.github.com/repos/solute/pyramid_epfl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solute/pyramid_epfl/issues/108/comments","statuses_url":"https://api.github.com/repos/solute/pyramid_epfl/statuses/cd08e48cabacba02eb050199746c38485ce074c7","head":{"label":"solute:paginated_list_layout_number_of_pages","ref":"paginated_list_layout_number_of_pages","sha":"cd08e48cabacba02eb050199746c38485ce074c7","user":{"login":"solute","id":557154,"avatar_url":"https://avatars.githubusercontent.com/u/557154?v=3","gravatar_id":"","url":"https://api.github.com/users/solute","html_url":"https://github.com/solute","followers_url":"https://api.github.com/users/solute/followers","following_url":"https://api.github.com/users/solute/following{/other_user}","gists_url":"https://api.github.com/users/solute/gists{/gist_id}","starred_url":"https://api.github.com/users/solute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solute/subscriptions","organizations_url":"https://api.github.com/users/solute/orgs","repos_url":"https://api.github.com/users/solute/repos","events_url":"https://api.github.com/users/solute/events{/privacy}","received_events_url":"https://api.github.com/users/solute/received_events","type":"Organization","site_admin":false},"repo":{"id":17905989,"name":"pyramid_epfl","full_name":"solute/pyramid_epfl","owner":{"login":"solute","id":557154,"avatar_url":"https://avatars.githubusercontent.com/u/557154?v=3","gravatar_id":"","url":"https://api.github.com/users/solute","html_url":"https://github.com/solute","followers_url":"https://api.github.com/users/solute/followers","following_url":"https://api.github.com/users/solute/following{/other_user}","gists_url":"https://api.github.com/users/solute/gists{/gist_id}","starred_url":"https://api.github.com/users/solute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solute/subscriptions","organizations_url":"https://api.github.com/users/solute/orgs","repos_url":"https://api.github.com/users/solute/repos","events_url":"https://api.github.com/users/solute/events{/privacy}","received_events_url":"https://api.github.com/users/solute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solute/pyramid_epfl","description":"EPFL Python Frontend Logic for Pyramid","fork":false,"url":"https://api.github.com/repos/solute/pyramid_epfl","forks_url":"https://api.github.com/repos/solute/pyramid_epfl/forks","keys_url":"https://api.github.com/repos/solute/pyramid_epfl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solute/pyramid_epfl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solute/pyramid_epfl/teams","hooks_url":"https://api.github.com/repos/solute/pyramid_epfl/hooks","issue_events_url":"https://api.github.com/repos/solute/pyramid_epfl/issues/events{/number}","events_url":"https://api.github.com/repos/solute/pyramid_epfl/events","assignees_url":"https://api.github.com/repos/solute/pyramid_epfl/assignees{/user}","branches_url":"https://api.github.com/repos/solute/pyramid_epfl/branches{/branch}","tags_url":"https://api.github.com/repos/solute/pyramid_epfl/tags","blobs_url":"https://api.github.com/repos/solute/pyramid_epfl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solute/pyramid_epfl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solute/pyramid_epfl/git/refs{/sha}","trees_url":"https://api.github.com/repos/solute/pyramid_epfl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solute/pyramid_epfl/statuses/{sha}","languages_url":"https://api.github.com/repos/solute/pyramid_epfl/languages","stargazers_url":"https://api.github.com/repos/solute/pyramid_epfl/stargazers","contributors_url":"https://api.github.com/repos/solute/pyramid_epfl/contributors","subscribers_url":"https://api.github.com/repos/solute/pyramid_epfl/subscribers","subscription_url":"https://api.github.com/repos/solute/pyramid_epfl/subscription","commits_url":"https://api.github.com/repos/solute/pyramid_epfl/commits{/sha}","git_commits_url":"https://api.github.com/repos/solute/pyramid_epfl/git/commits{/sha}","comments_url":"https://api.github.com/repos/solute/pyramid_epfl/comments{/number}","issue_comment_url":"https://api.github.com/repos/solute/pyramid_epfl/issues/comments{/number}","contents_url":"https://api.github.com/repos/solute/pyramid_epfl/contents/{+path}","compare_url":"https://api.github.com/repos/solute/pyramid_epfl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solute/pyramid_epfl/merges","archive_url":"https://api.github.com/repos/solute/pyramid_epfl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solute/pyramid_epfl/downloads","issues_url":"https://api.github.com/repos/solute/pyramid_epfl/issues{/number}","pulls_url":"https://api.github.com/repos/solute/pyramid_epfl/pulls{/number}","milestones_url":"https://api.github.com/repos/solute/pyramid_epfl/milestones{/number}","notifications_url":"https://api.github.com/repos/solute/pyramid_epfl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solute/pyramid_epfl/labels{/name}","releases_url":"https://api.github.com/repos/solute/pyramid_epfl/releases{/id}","created_at":"2014-03-19T13:56:00Z","updated_at":"2015-06-26T13:12:54Z","pushed_at":"2015-09-03T09:43:46Z","git_url":"git://github.com/solute/pyramid_epfl.git","ssh_url":"git@github.com:solute/pyramid_epfl.git","clone_url":"https://github.com/solute/pyramid_epfl.git","svn_url":"https://github.com/solute/pyramid_epfl","homepage":null,"size":9096,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"solute:master","ref":"master","sha":"d4ecbce1570c02d4e1315c89deb79805a96f0158","user":{"login":"solute","id":557154,"avatar_url":"https://avatars.githubusercontent.com/u/557154?v=3","gravatar_id":"","url":"https://api.github.com/users/solute","html_url":"https://github.com/solute","followers_url":"https://api.github.com/users/solute/followers","following_url":"https://api.github.com/users/solute/following{/other_user}","gists_url":"https://api.github.com/users/solute/gists{/gist_id}","starred_url":"https://api.github.com/users/solute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solute/subscriptions","organizations_url":"https://api.github.com/users/solute/orgs","repos_url":"https://api.github.com/users/solute/repos","events_url":"https://api.github.com/users/solute/events{/privacy}","received_events_url":"https://api.github.com/users/solute/received_events","type":"Organization","site_admin":false},"repo":{"id":17905989,"name":"pyramid_epfl","full_name":"solute/pyramid_epfl","owner":{"login":"solute","id":557154,"avatar_url":"https://avatars.githubusercontent.com/u/557154?v=3","gravatar_id":"","url":"https://api.github.com/users/solute","html_url":"https://github.com/solute","followers_url":"https://api.github.com/users/solute/followers","following_url":"https://api.github.com/users/solute/following{/other_user}","gists_url":"https://api.github.com/users/solute/gists{/gist_id}","starred_url":"https://api.github.com/users/solute/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solute/subscriptions","organizations_url":"https://api.github.com/users/solute/orgs","repos_url":"https://api.github.com/users/solute/repos","events_url":"https://api.github.com/users/solute/events{/privacy}","received_events_url":"https://api.github.com/users/solute/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solute/pyramid_epfl","description":"EPFL Python Frontend Logic for Pyramid","fork":false,"url":"https://api.github.com/repos/solute/pyramid_epfl","forks_url":"https://api.github.com/repos/solute/pyramid_epfl/forks","keys_url":"https://api.github.com/repos/solute/pyramid_epfl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solute/pyramid_epfl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solute/pyramid_epfl/teams","hooks_url":"https://api.github.com/repos/solute/pyramid_epfl/hooks","issue_events_url":"https://api.github.com/repos/solute/pyramid_epfl/issues/events{/number}","events_url":"https://api.github.com/repos/solute/pyramid_epfl/events","assignees_url":"https://api.github.com/repos/solute/pyramid_epfl/assignees{/user}","branches_url":"https://api.github.com/repos/solute/pyramid_epfl/branches{/branch}","tags_url":"https://api.github.com/repos/solute/pyramid_epfl/tags","blobs_url":"https://api.github.com/repos/solute/pyramid_epfl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solute/pyramid_epfl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solute/pyramid_epfl/git/refs{/sha}","trees_url":"https://api.github.com/repos/solute/pyramid_epfl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solute/pyramid_epfl/statuses/{sha}","languages_url":"https://api.github.com/repos/solute/pyramid_epfl/languages","stargazers_url":"https://api.github.com/repos/solute/pyramid_epfl/stargazers","contributors_url":"https://api.github.com/repos/solute/pyramid_epfl/contributors","subscribers_url":"https://api.github.com/repos/solute/pyramid_epfl/subscribers","subscription_url":"https://api.github.com/repos/solute/pyramid_epfl/subscription","commits_url":"https://api.github.com/repos/solute/pyramid_epfl/commits{/sha}","git_commits_url":"https://api.github.com/repos/solute/pyramid_epfl/git/commits{/sha}","comments_url":"https://api.github.com/repos/solute/pyramid_epfl/comments{/number}","issue_comment_url":"https://api.github.com/repos/solute/pyramid_epfl/issues/comments{/number}","contents_url":"https://api.github.com/repos/solute/pyramid_epfl/contents/{+path}","compare_url":"https://api.github.com/repos/solute/pyramid_epfl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solute/pyramid_epfl/merges","archive_url":"https://api.github.com/repos/solute/pyramid_epfl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solute/pyramid_epfl/downloads","issues_url":"https://api.github.com/repos/solute/pyramid_epfl/issues{/number}","pulls_url":"https://api.github.com/repos/solute/pyramid_epfl/pulls{/number}","milestones_url":"https://api.github.com/repos/solute/pyramid_epfl/milestones{/number}","notifications_url":"https://api.github.com/repos/solute/pyramid_epfl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solute/pyramid_epfl/labels{/name}","releases_url":"https://api.github.com/repos/solute/pyramid_epfl/releases{/id}","created_at":"2014-03-19T13:56:00Z","updated_at":"2015-06-26T13:12:54Z","pushed_at":"2015-09-03T09:43:46Z","git_url":"git://github.com/solute/pyramid_epfl.git","ssh_url":"git@github.com:solute/pyramid_epfl.git","clone_url":"https://github.com/solute/pyramid_epfl.git","svn_url":"https://github.com/solute/pyramid_epfl","homepage":null,"size":9096,"stargazers_count":1,"watchers_count":1,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":3,"forks":5,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108"},"html":{"href":"https://github.com/solute/pyramid_epfl/pull/108"},"issue":{"href":"https://api.github.com/repos/solute/pyramid_epfl/issues/108"},"comments":{"href":"https://api.github.com/repos/solute/pyramid_epfl/issues/108/comments"},"review_comments":{"href":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108/comments"},"review_comment":{"href":"https://api.github.com/repos/solute/pyramid_epfl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solute/pyramid_epfl/pulls/108/commits"},"statuses":{"href":"https://api.github.com/repos/solute/pyramid_epfl/statuses/cd08e48cabacba02eb050199746c38485ce074c7"}}}}