/**
   * This method takes a string, and replaces all file separators and space etc by normal
   * characters.
   */
  private String niceifyLink(String link) {
    link = URLDecoder.decode(link);
    if (link.equals("/")) return "index.html";

    int i1, i2;
    // trim off the project path if it exists
    String testDir = parent.getProperty("qat.project.path"); // "/local/workspaces/QAT/examples"
    i1 = link.indexOf(testDir);
    if (i1 >= 0) {
      link = link.substring(0, i1) + link.substring(i1 + testDir.length() + 1, link.length());
    }

    // trim off the qat basedir path if it exists
    String projectResultsDir =
        parent.getProjectResultsDirectory(); // "/home/webhiker/.qat/harness/results/examples"
    i1 = link.indexOf(projectResultsDir);
    if (i1 >= 0) {
      link =
          link.substring(0, i1)
              + link.substring(i1 + projectResultsDir.length() + 1, link.length());
    }

    link = link.replace('\\', '_').replace('/', '_').replace(' ', '_').replace(':', '_') + ".html";
    return link;
  }