Database connected Repeater -Foward/Backward Button (page check)

I got my database of testimonials connected to my repeater and before it also went to the next or previous testimonial on the database page.

Though when I like to code that the code checks every time if there is a next or previous database page to enable/disable the button I’m not able to figure out how to properly code it.

I tried it with if/else functions and also tried to adapt the let function but none of it works.

The code that currently is working with a simple forward/back button is the following:

$w.onReady(function () {

    $w('#dataset1').onReady(_ => {
        if($w("#dataset1").hasNextPage()){
            $w("#testnextforward").enable();
        } else {
            $w("#testnextforward").disable();
        }
        if($w("#dataset1").hasPreviousPage()){
            $w("#testnextback").enable();
        } else {
            $w("#testnextback").disable();
        }
    }
    )})
if ($w('#dataset1').hasNextPage()){
            $w("#testnextforward").onClick(_ => {
                $w('#dataset1').nextPage();{
                
}

Thank you very much in advance.