This check should not be executing in .twig template. This is a task for controller.
Go to catalog/controller/product/category.php
Find
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
Replaced it with
if ($page == 1) {
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
} else {
$data['description'] = '';
}
Tested, works perfect. No template edition needed. Restore your .twig file to the original condition.
If you don't see any changes - clear caches according to this instruction https://stackoverflow.com/a/61524855/3187127
UPDATED
Or, if you want to check anything else in template
Go to catalog/controller/product/category.php
Find
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
Add below
if ($page == 1) {
$data['firstpage'] = 1;
} else {
$data['firstpage'] = '';
}
Now on your catalog/view/theme/YOUR_THEME/template/product/category.twig you can make check like this
{% if firstpage %}
This is the first page.
{% endif %}
UPDATED 2
After previous manipulation your code should be like this
if (isset($this->request->get['page'])) {
$page = $this->request->get['page'];
} else {
$page = 1;
}
if ($page == 1) {
$data['firstpage'] = 1;
} else {
$data['firstpage'] = '';
}