@@ -195,10 +195,10 @@ include file="/minisearch.jspf"
195195
196196 Format df = new SimpleDateFormat (" dd-MMM-yyyy" );
197197
198- int revision2 = Math . max(cfg. getIntParam(QueryParameters . REVISION_2_PARAM , - 1 ), 0 );
199- int revision1 = cfg. getIntParam(QueryParameters . REVISION_1_PARAM , - 1 ) < revision2 ?
200- revision2 + 1 : cfg. getIntParam(QueryParameters . REVISION_1_PARAM , - 1 );
201- revision2 = revision2 >= hist. getHistoryEntries(). size() ? hist. getHistoryEntries(). size() - 1 : revision2 ;
198+ int revision2Index = Math . max(cfg. getIntParam(QueryParameters . REVISION_2_PARAM , - 1 ), 0 );
199+ int revision1Index = cfg. getIntParam(QueryParameters . REVISION_1_PARAM , - 1 ) < revision2Index ?
200+ revision2Index + 1 : cfg. getIntParam(QueryParameters . REVISION_1_PARAM , - 1 );
201+ revision2Index = revision2Index >= hist. getHistoryEntries(). size() ? hist. getHistoryEntries(). size() - 1 : revision2Index ;
202202
203203 int startIndex = cfg. getStartIndex();
204204 int maxItems = cfg. getMaxItems();
@@ -229,13 +229,13 @@ document.domReady.push(function() {domReadyHistory();});
229229 if (! cfg. isDir()) {
230230 % >
231231 <th ><input type =" submit" value =" Compare " />
232- <% if (hist. getHistoryEntries(). size() > revision1 && revision1 >= 0 ) { % >
232+ <% if (hist. getHistoryEntries(). size() > revision1Index && revision1Index >= 0 ) { % >
233233 <input type =" hidden" id =" input_r1" name =" <%= QueryParameters . REVISION_1_PARAM % >"
234- value =" <%= path + ' @' + hist. getHistoryEntries(). get(revision1 ). getRevision() % >" />
234+ value =" <%= path + ' @' + hist. getHistoryEntries(). get(revision1Index ). getRevision() % >" />
235235 <% } % >
236- <% if (hist. getHistoryEntries(). size() > revision2 && revision2 >= 0 ) { % >
236+ <% if (hist. getHistoryEntries(). size() > revision2Index && revision2Index >= 0 ) { % >
237237 <input type =" hidden" id =" input_r2" name =" <%= QueryParameters . REVISION_2_PARAM % >"
238- value =" <%= path + ' @' + hist. getHistoryEntries(). get(revision2 ). getRevision() % >" />
238+ value =" <%= path + ' @' + hist. getHistoryEntries(). get(revision2Index ). getRevision() % >" />
239239 <% } % >
240240 </th ><%
241241 }
@@ -299,34 +299,34 @@ document.domReady.push(function() {domReadyHistory();});
299299 % > <input type =" radio"
300300 aria-label =" From"
301301 data-revision-1 =" <%= (startIndex + count) % >"
302- data-revision-2 =" <%= revision2 % >"
302+ data-revision-2 =" <%= revision2Index % >"
303303 data-diff-revision =" <%= QueryParameters . REVISION_1_PARAM % >"
304304 data-revision-path =" <%= path + ' @' + hist. getHistoryEntries(). get(startIndex + count). getRevision() % >"
305305 <%
306- if (count + startIndex > revision1 || (count + startIndex > revision2 && count + startIndex <= revision1 - 1)) {
306+ if (count + startIndex > revision1Index || (count + startIndex > revision2Index && count + startIndex <= revision1Index - 1)) {
307307 // revision1 enabled
308- } else if (count + startIndex == revision1 ) {
308+ } else if (count + startIndex == revision1Index ) {
309309 // revision1 selected
310310 %> checked="checked"<%
311- } else if (count + startIndex <= revision2 ) {
311+ } else if (count + startIndex <= revision2Index ) {
312312 // revision1 disabled
313313 % > disabled="disabled" <%
314314 }
315315 % > /><%
316316
317317 % > <input type =" radio"
318318 aria-label =" To"
319- data-revision-1 =" <%= revision1 % >"
319+ data-revision-1 =" <%= revision1Index % >"
320320 data-revision-2 =" <%= (startIndex + count) % >"
321321 data-diff-revision =" <%= QueryParameters . REVISION_2_PARAM % >"
322322 data-revision-path =" <%= path + ' @' + hist. getHistoryEntries(). get(startIndex + count). getRevision() % >"
323323 <%
324- if (count + startIndex < revision2 || (count + startIndex > revision2 && count + startIndex <= revision1 - 1)) {
324+ if (count + startIndex < revision2Index || (count + startIndex > revision2Index && count + startIndex <= revision1Index - 1)) {
325325 // revision2 enabled
326- } else if (count + startIndex == revision2 ) {
326+ } else if (count + startIndex == revision2Index ) {
327327 // revision2 selected
328328 %> checked="checked" <%
329- } else if (count + startIndex >= revision1 ) {
329+ } else if (count + startIndex >= revision1Index ) {
330330 // revision2 disabled
331331 % > disabled="disabled" <%
332332 }
0 commit comments