Show
Ignore:
Timestamp:
05/28/08 10:32:31 (18 months ago)
Author:
fumiakiy
Message:

Calculate and set offset value correctly when the number of items appearing on a page is changed. BugId:79897

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-39/lib/MT/CMS/Entry.pm

    r2417 r2454  
    559559    $arg{direction} = 'descend'; 
    560560    $arg{limit}     = $limit + 1; 
    561     if ( $total && $offset > $total - 1 ) { 
     561    if ( $total <= $limit ) { 
     562        delete $arg{limit}; 
     563        $offset = 0; 
     564    } 
     565    elsif ( $total && $offset > $total - 1 ) { 
    562566        $arg{offset} = $offset = $total - $limit; 
    563567    } 
    564568    elsif ( $offset && ( ( $offset < 0 ) || ( $total - $offset < $limit ) ) ) { 
    565         $arg{offset} = $offset = 0; 
     569        $arg{offset} = $offset = $total - $limit; 
    566570    } 
    567571    else {