<commit_before>/*
 * utils.h
 *
 * Copyright (C) 2011-2013	OpenTech Labs
 *				<NAME> <<EMAIL>>
 *
 *		 2016		<NAME> <<EMAIL>>
 *
 * Released under the GNU Affero General Public License version 3.
 * See COPYING
 */

#ifndef _UTILS_H_
#define _UTILS_H_

#include <stdbool.h>

#include <flate.h>

struct pagination {
	int requested_page;	/* Page requested by client */
	int page_no;		/* Page being returned to client */
	int rows_per_page;	/* Rows to show on each page */
	int nr_pages;		/* Number of pages across result set */
	int from;		/* Index into the result set to start from */
};

/* Pagination macro's */
#define IS_MULTI_PAGE(nr_pages)		(((nr_pages) > 1) ? 1 : 0)
#define IS_FIRST_PAGE(page)		(((page) == 1) ? 1 : 0)
#define IS_LAST_PAGE(page, nr_pages)	(((page) == (nr_pages)) ? 1 : 0)

char *get_tenant(const char *host, char *tenant);
char *generate_hash(char *hash, int type);
void free_avars(void);
void free_vars(GHashTable *vars);
void free_u_files(void);
void set_vars(void);
GHashTable *get_dbrow(MYSQL_RES *res);
const char *get_avar(int index, const char *key);
const char *get_var(GHashTable *vars, const char *key);
void free_fields(void);
void free_env_vars(void);<commit_msg>www: utils.h: Add a missing header file<commit_after>/*
 * utils.h
 *
 * Copyright (C) 2011-2013	OpenTech Labs
 *				<NAME> <<EMAIL>>
 *
 *		 2016		<NAME> <<EMAIL>>
 *
 * Released under the GNU Affero General Public License version 3.
 * See COPYING
 */

#ifndef _UTILS_H_
#define _UTILS_H_

#include <stdbool.h>

#include <flate.h>

#include <glib.h>

struct pagination {
	int requested_page;	/* Page requested by client */
	int page_no;		/* Page being returned to client */
	int rows_per_page;	/* Rows to show on each page */
	int nr_pages;		/* Number of pages across result set */
	int from;		/* Index into the result set to start from */
};

/* Pagination macro's */
#define IS_MULTI_PAGE(nr_pages)		(((nr_pages) > 1) ? 1 : 0)
#define IS_FIRST_PAGE(page)		(((page) == 1) ? 1 : 0)
#define IS_LAST_PAGE(page, nr_pages)	(((page) == (nr_pages)) ? 1 : 0)

char *get_tenant(const char *host, char *tenant);
char *generate_hash(char *hash, int type);
void free_avars(void);
void free_vars(GHashTable *vars);
void free_u_files(void);
void set_vars(void);
GHashTable *get_dbrow(MYSQL_RES *res);
const char *get_avar(int index, const char *key);
const char *get_var(GHashTable *vars, const char *key);
void free_fields(void);
void free_env_vars(void);
{'fraction_non_alphanumeric': 0.1394683026584867, 'fraction_numerical': 0.01717791411042945, 'mean_word_length': 4.459821428571429, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '7502988', 'n_tokens_mistral': 965, 'n_tokens_neox': 917, 'n_words': 277}