anchor.diff:  
       String pageurl = wiki.encodeName( pagereq );    
   
  +    // If "r1" is null, then assume current version (= -1)
  +    // If "r2" is null, then assume the previous version (=current version-1)
  +
       String srev1 = request.getParameter("r1");
       String srev2 = request.getParameter("r2");
   
  -    if( srev1 == null || srev2 == null )
  +    int ver1 = -1, ver2 = -1;
  +
  +    if( srev1 != null )
       {
  -        throw new ServletException("Empty parameters given to Diff.jsp");
  -    }    
  +        ver1 = Integer.parseInt( srev1 );
  +    }
   
  -    int ver1 = Integer.parseInt( srev1 );
  -    int ver2 = Integer.parseInt( srev2 );
  +    if( srev2 != null )
  +    {
  +        ver2 = Integer.parseInt( srev2 );
  +    }
  +    else
  +    {
  +        int lastver = wiki.getVersion( pagereq );
  +
  +        if( lastver > 1 )
  +        {
  +            ver2 = lastver-1;
  +        }
  +    }
  +
  +    String versionDescription1 = getVersionText( ver1 );
  +    String versionDescription2 = getVersionText( ver2 );
   
       log.debug("Request for page diff for '"+pagereq+"' from "+request.getRemoteHost()+" by "+request.getRemoteUser()+".  R1="+ver1+", R2="+ver2 );
   
  
positive.code:          if( wiki.pageExists( pagereq ) )
           {
               %>
               Difference between revision <%=ver1%> and <%=ver2%>
               <P>
               <PRE>
  <%=wiki.getDiff( pagereq, ver2, ver1 )%>
  
negative.code:     {
          wiki = WikiEngine.getInstance( getServletConfig() );
      }
  
      String getVersionText( int ver )
      {
          return ver > 0 ? ("version "+ver) : "current version";
      }
  
      Category log = Category.getInstance("JSPWiki"); 
      WikiEngine wiki;
  %>
  