Page navigation doesn’t show when query category

I found a partial workaround. Since the query object in the index.php is the right one I transferred it using serialize to template of choice, in this case category-video.php.

In index.php i put on top

<?php $s = serialize($wp_query);
file_put_contents('query',$s); ?>

and in category-video.php I put

<?php $u = file_get_contents('query');
$wp_the_query = unserialize($u); ?>

It’s not the solution, but It’s workaround and the page navigation is showing and partially working now. Numbers on navigation don’t show current page correctly, but previous and next are working, as well as clicking on page number. It’s Wp-PageNavi plugin.

Edit: I fixed page numbers also. For some reason after the wp_reset_query() $wp_query->get('paged') returned wrong number, don’t ask me why, I don’t know.
So I took $paged from before and set new query var after the wp_reset_query.

query_posts($query_string.$orderby);                        
$my_page = $wp_query->get('paged') 

/*code for looping the posts*/

wp_reset_query();
set_query_var('paged',$my_page);

Now, the WP-pagenavi show correct page numbers.

EDIT: the problem is in the PDO plugin and Sqlite, I tested it.