<commit_before><%@ page import="java.net.URLEncoder" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.util.Random" %>
<%@ page import="java.util.logging.Logger" %>
<%@ page import="ru.org.linux.site.AccessViolationException" %>
<%@ page import="ru.org.linux.site.Template" %>
<%@ page import="ru.org.linux.site.User" %>
<%@ page import="ru.org.linux.site.UserErrorException" %>
<%@ page import="ru.org.linux.util.HTMLFormatter" %>
<%@ page pageEncoding="koi8-r" contentType="text/html;charset=utf-8" language="java" errorPage="/error.jsp" %>
<% Template tmpl = new Template(request, config, response);
  Logger logger = Logger.getLogger("ru.org.linux");
%>
<%= tmpl.head() %>
<title>usermod</title>
<%= tmpl.DocumentHeader() %>
<%
  if (!tmpl.isModeratorSession()) {
    throw new IllegalAccessException("Not authorized");
  }

  String action = tmpl.getParameters().getString("action");
  int id = tmpl.getParameters().getInt("id");

  if (!request.getMethod().equals("POST")) {
    throw new IllegalAccessException("Invalid method");
  }

  Connection db = null;

  try {
    db = tmpl.getConnection();
    db.setAutoCommit(false);

    Statement st = db.createStatement();

    User user = User.getUser(db, id);

    User moderator = User.getUser(db, (String) session.getValue("nick"));

    boolean redirect = true;

    if (action.equals("block") || action.equals("block-n-delete-comments")) {
      if (!user.isBlockable()) {
        throw new AccessViolationException(" " + user.getNick() + "  ");
      }

      user.block(db);
      st.executeUpdate("UPDATE users SET blocked='t' WHERE id=" + id);
      logger.info("User " + user.getNick() + " blocked by " + session.getValue("nick"));

      if (action.equals("block-n-delete-comments")) {
        out.print(user.deleteAllComments(db, moderator));
        redirect = false;
      }
    } else if (action.equals("unblock")) {
      if (!user.isBlockable()) {
        throw new AccessViolationException(" " + user.getNick() + "  ");
      }

      st.executeUpdate("UPDATE users SET blocked='f' WHERE id=" + id);
      logger.info("User " + user.getNick() + " unblocked by " + session.getValue("nick"));
    } else if (action.equals("remove_userpic")) {
      if (user.canModerate()) {
        throw new AccessViolationException(" " + user.getNick() + "   ");
      }

      if (user.getPhoto() == null) {
        throw new AccessViolationException(" " + user.getNick() + "   ");
      }

      st.executeUpdate("UPDATE users SET photo=null WHERE id=" + id);
      st.executeUpdate("UPDATE users SET score=score-10 WHERE id=" + id);
      logger.info("Clearing " + user.getNick() + " userpic");
    } else if (action.equals("remove_userinfo")) {
      if (user.canModerate()) {
        throw new AccessViolationException(" " + user.getNick() + "   ");
      }

      tmpl.getObjectConfig().getStorage().updateMessage("userinfo", String.valueOf(id), "");

      st.executeUpdate("UPDATE users SET score=score-10 WHERE id=" + id);
      logger.info("Clearing " + user.getNick() + " userinfo");
    } else {
      throw new UserErrorException("Invalid action=" + HTMLFormatter.htmlSpecialChars(action));
    }<commit_msg>В логах сообщение     -INFO: Clearing $user userpic     +INFO: Clearing $user userpic by $moderator<commit_after><%@ page import="java.net.URLEncoder" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %>
<%@ page import="java.util.Random" %>
<%@ page import="java.util.logging.Logger" %>
<%@ page import="ru.org.linux.site.AccessViolationException" %>
<%@ page import="ru.org.linux.site.Template" %>
<%@ page import="ru.org.linux.site.User" %>
<%@ page import="ru.org.linux.site.UserErrorException" %>
<%@ page import="ru.org.linux.util.HTMLFormatter" %>
<%@ page pageEncoding="koi8-r" contentType="text/html;charset=utf-8" language="java" errorPage="/error.jsp" %>
<% Template tmpl = new Template(request, config, response);
  Logger logger = Logger.getLogger("ru.org.linux");
%>
<%= tmpl.head() %>
<title>usermod</title>
<%= tmpl.DocumentHeader() %>
<%
  if (!tmpl.isModeratorSession()) {
    throw new IllegalAccessException("Not authorized");
  }

  String action = tmpl.getParameters().getString("action");
  int id = tmpl.getParameters().getInt("id");

  if (!request.getMethod().equals("POST")) {
    throw new IllegalAccessException("Invalid method");
  }

  Connection db = null;

  try {
    db = tmpl.getConnection();
    db.setAutoCommit(false);

    Statement st = db.createStatement();

    User user = User.getUser(db, id);

    User moderator = User.getUser(db, (String) session.getValue("nick"));

    boolean redirect = true;

    if (action.equals("block") || action.equals("block-n-delete-comments")) {
      if (!user.isBlockable()) {
        throw new AccessViolationException(" " + user.getNick() + "  ");
      }

      user.block(db);
      st.executeUpdate("UPDATE users SET blocked='t' WHERE id=" + id);
      logger.info("User " + user.getNick() + " blocked by " + session.getValue("nick"));

      if (action.equals("block-n-delete-comments")) {
        out.print(user.deleteAllComments(db, moderator));
        redirect = false;
      }
    } else if (action.equals("unblock")) {
      if (!user.isBlockable()) {
        throw new AccessViolationException(" " + user.getNick() + "  ");
      }

      st.executeUpdate("UPDATE users SET blocked='f' WHERE id=" + id);
      logger.info("User " + user.getNick() + " unblocked by " + session.getValue("nick"));
    } else if (action.equals("remove_userpic")) {
      if (user.canModerate()) {
        throw new AccessViolationException(" " + user.getNick() + "   ");
      }

      if (user.getPhoto() == null) {
        throw new AccessViolationException(" " + user.getNick() + "   ");
      }

      st.executeUpdate("UPDATE users SET photo=null WHERE id=" + id);
      st.executeUpdate("UPDATE users SET score=score-10 WHERE id=" + id);
      logger.info("Clearing " + user.getNick() + " userpic by " + session.getValue("nick"));
    } else if (action.equals("remove_userinfo")) {
      if (user.canModerate()) {
        throw new AccessViolationException(" " + user.getNick() + "   ");
      }

      tmpl.getObjectConfig().getStorage().updateMessage("userinfo", String.valueOf(id), "");

      st.executeUpdate("UPDATE users SET score=score-10 WHERE id=" + id);
      logger.info("Clearing " + user.getNick() + " userinfo");
    } else {
      throw new UserErrorException("Invalid action=" + HTMLFormatter.htmlSpecialChars(action));
    }
{'fraction_non_alphanumeric': 0.17995444191343962, 'fraction_numerical': 0.0018223234624145787, 'mean_word_length': 3.5767894371091034, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4365751', 'n_tokens_mistral': 2129, 'n_tokens_neox': 2019, 'n_words': 388}