->query('SELECT COUNT(DISTINCT e.eid) FROM {l10n_server_project} p LEFT JOIN {l10n_server_release} r ON p.pid = r.pid LEFT JOIN {l10n_server_error} e ON r.rid = e.rid WHERE p.uri = :uri',[':uri'=>$project->getUri()]);
// Simple count query if we are not filtering by project.
$count1_sql="SELECT COUNT(sid) AS translation_count, language FROM {l10n_server_status_flag} WHERE has_translation = 1 GROUP BY language";
$count2_sql="SELECT COUNT(sid) AS translation_count, language FROM {l10n_server_status_flag} WHERE has_suggestion = 1 GROUP BY language";
$count_args=[];
}
else{
// More complex joins if we also need to factor the project in.
$count1_sql="SELECT COUNT(DISTINCT ts.sid) AS translation_count, ts.language FROM {l10n_server_line} l INNER JOIN {l10n_server_status_flag} ts ON l.sid = ts.sid WHERE l.pid = :pid AND ts.has_translation = 1 GROUP BY ts.language";
$count2_sql="SELECT COUNT(DISTINCT ts.sid) AS translation_count, ts.language FROM {l10n_server_line} l INNER JOIN {l10n_server_status_flag} ts ON l.sid = ts.sid WHERE l.pid = :pid AND ts.has_suggestion = 1 GROUP BY ts.language";
$count_sql="SELECT COUNT(DISTINCT ts.sid) AS translation_count FROM {l10n_server_line} l LEFT JOIN {l10n_server_status_flag} ts ON l.sid = ts.sid WHERE ts.$column = 1 ";
// Get summaries of people having most active translations per language.
// Skip anonymous since that is used for placeholders when there was no
// prior translations for a suggestion.
$result=$this->connection
->queryRange("SELECT COUNT(DISTINCT t.sid) AS sum, u.name, u.uid FROM {l10n_server_translation} t LEFT JOIN {users_field_data} u ON t.uid = u.uid WHERE t.status = 1 AND t.suggestion = 0 AND t.language = :lng AND u.uid != 0 GROUP BY t.uid ORDER BY sum DESC",0,10,[':lng'=>$langcode]);