In China, don’t question the heroes.

At least seven people over the past week have been threatened, detained or arrested after casting doubt over the government’s account of the deaths of Chinese soldiers during a clash last year with Indian troops. Three of them are being detained for between seven and 15 days. The other four face criminal charges, including one man who lives outside China.

“The internet is not a lawless place,” said the police notices issued in their cases. “Blasphemies of heroes and martyrs will not be tolerated.”

Their punishment might have gone unnoticed if it wasn’t for an online database of speech crimes in China. A simple Google spreadsheet open for all to see, it lists nearly 2,000 times when people were punished by the government for what they said online and offline.

The list — which links directly to publicly issued verdicts, police notices and official news reports over the past eight years — is far from complete. Most punishment takes place behind closed doors.

Still, the list paints a bleak picture of a government that punishes its citizens for the slightest hint of criticism. It shows how random and merciless China’s legal system can be when it punishes its citizens for what they say, even though freedom of speech is written into China’s Constitution.

The list describes dissidents sentenced to long prison terms for attacking the government. It tells of petitioners, those who appeal directly to the government to right the wrongs against them, locked up for making too loud a clamor. It covers nearly 600 people punished for what they said about Covid-19, and too many others who cursed out police, often after receiving parking tickets.

The person behind the list is a bit of a mystery. In an interview, he described himself as a young man surnamed Wang. Of course, if the government found out more about him, he could end up in prison.

Mr. Wang said he decided to compile the list after reading about people who were punished for supposedly insulting the country during celebrations of the 70th anniversary of the founding of the People’s Republic, in October 2019. Though he is young, he told me, he remembers more freedom of expression before Xi Jinping became the Communist Party’s top leader in late 2012.

“I knew that there were speech crimes in China, but I’ve never thought it’s so bad,” Mr. Wang posted in August on his Twitter account, where he writes in both English and Chinese. He wrote that he had become depressed after reading more than 1,000 verdicts.

“Big Brother is watching you,” he wrote. “I tried to look for the eyes of Big Brother and ended up finding them everywhere.”

The list, bluntly titled “An Inventory of Speech Crimes in China in Recent Years,” detailed what happened to those who questioned Beijing’s official account of the June clash between Chinese and Indian forces at their disputed border in the Himalayas. The Indian government said then that 20 of its soldiers had died. Last week, the Chinese government finally said four of its troops had died.

State-run media in China called them heroes, but some people had questions. One, a former journalist, asked whether more had died, a question of intense interest both in and out of the country. According to the notice the spreadsheet linked to, the former journalist was charged with picking quarrels and provoking trouble — a common accusation by the authorities against those who speak up — and faces up to five years imprisonment.

Reading the list, it becomes clear how well Mr. Xi and his government have tamed the Chinese internet. People once thought the internet was uncontrollable, even in China. But Mr. Xi has long seen the internet as both a threat to be contained and a tool for guiding public opinion.

“The internet is the biggest variant we’re facing,” he said in a 2018 speech. “Whether we can win the war over the internet will have a direct impact of national political security.”

Liberal-leaning voices and media were among the first to be silenced. Then internet platforms themselves — the Chinese versions of Twitter and YouTube, among many others — were punished for what they allowed.

Now, Chinese internet companies brag about their ability to control content. Nationalistic online users report speech they deem offensive. Out of the seven people who were accused of insulting the heroes and martyrs, six were reported by other users, according to the police notices. In some ways, the Chinese internet polices itself.

China’s police, who are widely disliked for their broad powers to lock people up indefinitely, are big beneficiaries. According to the spreadsheet, people have been detained for calling the police “dogs,” “bandits” and “bastards.” Most are locked up for only a few days, but one man in Liaoning Province was sentenced to 10 months in jail for writing five offensive posts on his WeChat timeline.

Petitioners are among those who suffer the most. In one case on the spreadsheet, a woman in Sichuan Province whose son died suddenly at school and whose husband committed suicide was sentenced to three years in prison for charges that included spreading false information. The verdict listed the headlines of 10 articles she posted and the page views they garnered. The most got 1,615 page views, while the least got only 18.

Perhaps the most depressing items are those about people who were punished for what they said about the Covid-19 pandemic. On top of the list is Dr. Li Wenliang, who was reprimanded on January 1, 2020, along with seven others for trying to warn the country about the coronavirus. He died in early February last year of the virus and is now remembered as the whistle-blower who tried to warn the world about the coronavirus outbreak. But the spreadsheet lists 587 other cases.

Even cheesy skits by aspiring online influencers can be deemed offensive. Two men in northwestern Shaanxi Province livestreamed a funeral they held for a sheep. In the video, one man cried over a photo of the sheep while the other dug the grave. They were detained 10 days for violating social customs.

But the spreadsheet also highlights inspiring cases in which people spoke out to challenge authority.

In 2018, a 19-year-old man in northwestern city of Yinchuan decided to test the newly passed law that prohibits questioning and criticizing heroes and martyrs. He posted on Weibo that two famous martyrs died meaningless deaths and that he wanted to see if he would be arrested, showing a lack of free speech in China. He was detained for 10 days and fined $70.

One man, Feng Zhouguan, criticized Mr. Xi and was charged with picking quarrels by the local police in the city of Xiamen. He was detained for five days but appealed after his release, arguing that police had improperly interfered in a potential libel cases between two individuals. The local police, he argued, are “not the military bodyguards or family militia of the national leader.” The court upheld the sentence.

Still, many people pay a steeper price.

Huang Genbao, 45, was a senior engineer at a state-owned company in the eastern city of Xuzhou. Two years ago he was arrested and sentenced to 16 months in jail for insulting the national leader and harming the national image on platforms like Twitter. He shared a cell with as many as more than 20 people and had to follow a strict routine, including toilet breaks. He and his wife lost their jobs, and he now delivers meals to support his family.

“My life in the detention center reminded me of the book ‘1984,’” he said in an interview. “Many of the experiences are probably worse than the plots in the book.”