  def add_statistics_group
    Log.add_info(request, params.inspect)

    return unless request.post?

    current_id = params[:current_id]

    unless params[:thetisBoxSelKeeper].nil?
      group_id = params[:thetisBoxSelKeeper].split(':').last
    end
    SqlHelper.validate_token([current_id, group_id])

    if group_id.blank?
      @group_ids = Research.get_statistics_groups
      render(:partial => 'ajax_statistics_groups', :layout => false)
      return
    end

    unless current_id.blank?
      Research.delete_statistics_group(current_id)
    end

    @group_ids = Research.add_statistics_group(group_id)

    render(:partial => 'ajax_statistics_groups', :layout => false)
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.