original_string: public static function cleanup_recent_session_locks() {
          global $SESSION;
  
          $locks = self::get_recent_session_locks();
          if (count($locks) > 2) {
              for ($i = count($locks) - 1; $i > 0; $i--) {
                  // Calculate the gap between session locks.
                  $gap = $locks[$i]['released'] - $locks[$i - 1]['start'];
                  if ($gap >= 10) {
                      // Remove previous locks if the gap is 10 seconds or more.
                      $SESSION->recentsessionlocks = array_slice($locks, $i);
                      break;
                  }
              }
          }
      }
code: public static function cleanup_recent_session_locks() {
          global $SESSION;
  
          $locks = self::get_recent_session_locks();
          if (count($locks) > 2) {
              for ($i = count($locks) - 1; $i > 0; $i--) {
                  // Calculate the gap between session locks.
                  $gap = $locks[$i]['released'] - $locks[$i - 1]['start'];
                  if ($gap >= 10) {
                      // Remove previous locks if the gap is 10 seconds or more.
                      $SESSION->recentsessionlocks = array_slice($locks, $i);
                      break;
                  }
              }
          }
      }
code_tokens: public static function cleanup_recent_session_locks ( ) { global $ SESSION ; $ locks = self :: get_recent_session_locks ( ) ; if ( count ( $ locks ) > 2 ) { for ( $ i = count ( $ locks ) - 1 ; $ i > 0 ; $ i -- ) { // Calculate the gap between session locks. $ gap = $ locks [ $ i ] [ 'released' ] - $ locks [ $ i - 1 ] [ 'start' ] ; if ( $ gap >= 10 ) { // Remove previous locks if the gap is 10 seconds or more. $ SESSION -> recentsessionlocks = array_slice ( $ locks , $ i ) ; break ; } } } }
docstring: Reset recent session locks array if there is a 10 seconds time gap.
  
  @return array Recent session locks array.
docstring_tokens: Reset recent session locks array if there is a 10 seconds time gap .