docs: private void addFile(int index, String file) {
          if (maxFiles > 0) {
              int numFiles = files.size();
              int maxDateFiles = getMaxDateFiles();
  
              // If there is no max or we have fewer than max, then we're done.
              if (maxDateFiles <= 0 || numFiles < maxDateFiles) {
                  files.add(index, file);
              } else {
                  // The file names we deal with (messages_xx.xx.xx_xx.xx.xx.log)
                  // have dates, and we want to always be using the "most recent",
                  // so delete everything "newer" (index and after), which might be
                  // present if the system clock goes backwards, and then delete
                  // the oldest files until only maxDateFiles-1 remain.
                  while (files.size() > index) {
                      removeFile(files.size() - 1);
                  }
                  while (files.size() >= maxDateFiles) {
                      removeFile(0);
                  }
  
                  files.add(file);
              }
          }
      }