docs: private String validateFilename(String filename) {
  
          // if its an external filename, use it directly
          if (isExternal(filename)) {
              return filename;
          }
  
          // check if this resource name does already exist
          // if so add a postfix to the name
  
          int postfix = 1;
          boolean found = true;
          String validFilename = filename;
  
          // if we are not in overwrite mode, we must find a valid, non-existing filename
          // otherwise we will use the current translated name
          if (!m_overwrite) {
  
              while (found) {
                  try {
                      // get the translated name, this one only contains valid chars in OpenCms
                      validFilename = m_cmsObject.getRequestContext().getFileTranslator().translateResource(
                          validFilename);
  
                      // try to read the file.....
                      found = true;
                      // first try to read it form the fileIndex of already processed files
                      if (!m_fileIndex.containsValue(validFilename.replace('\\', '/'))) {
                          found = false;
                      }
                      if (!found) {
                          found = true;
                          // there was no entry in the fileIndex, so try to read from the VFS
                          m_cmsObject.readResource(validFilename, CmsResourceFilter.ALL);
                      }
                      // ....it's there, so add a postfix and try again
                      String path = filename.substring(0, filename.lastIndexOf("/") + 1);
                      String name = filename.substring(filename.lastIndexOf("/") + 1, filename.length());
                      validFilename = path;
                      if (name.lastIndexOf(".") > 0) {
                          validFilename += name.substring(0, name.lastIndexOf("."));
                      } else {
                          validFilename += name;
                      }
                      validFilename += "_" + postfix;
                      if (name.lastIndexOf(".") > 0) {
                          validFilename += name.substring(name.lastIndexOf("."), name.length());
                      }
                      postfix++;
                  } catch (CmsException e) {
                      // the file does not exist, so we can use this filename
                      found = false;
                  }
              }
  
          } else {
              validFilename = validFilename.replace('\\', '/');
          }
  
          return OpenCms.getResourceManager().getFileTranslator().translateResource(validFilename);
      }