public void purge(boolean links, String... titles) throws IOException, CredentialNotFoundException
    {
        if (user == null)
            throw new CredentialNotFoundException("You need to be logged in to purge pages via the API.");
        StringBuilder url = new StringBuilder(apiUrl);
        StringBuilder log = new StringBuilder("Successfully purged { \""); // log statement
        url.append("action=purge");
        if (links)
            url.append("&forcelinkupdate");
        url.append("&titles=");
        for (int i = 0; i < titles.length; i++)
        {
            url.append(URLEncoder.encode(titles[i], "UTF-8"));
            log.append(titles[i]);
            if (i != titles.length - 1)
            {
                url.append("%7C");
                log.append("\", ");
            }
            else
                log.append("\" }");
        }
        fetch(url.toString(), "purge");
        // System.out.writeln(fetch(url.toString(), "purge", false)); // for debugging purposes
        log(Level.INFO, log.toString(), "purge"); // done, log
    }